aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-04-30 23:41:16 +0000
committerDouglas Gregor <dgregor@apple.com>2012-04-30 23:41:16 +0000
commit8e5900c8e9bd32bcc385124f564f3d38a11d0e28 (patch)
treebc9b03b6520705abb70b9a62b87239141c027d2b /tools/libclang
parentaa5498649c7ad1b61e5da2497e8c60c924ac5e55 (diff)
clang_getCursorLexicalParent should return a translation unit cursor for declarations at the global scope, from Evan P. Fixes PR9083.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang')
-rw-r--r--tools/libclang/CIndex.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 0beb32d6c9..b2de22f23a 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -2831,8 +2831,8 @@ CXString clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit) {
}
CXCursor clang_getTranslationUnitCursor(CXTranslationUnit TU) {
- CXCursor Result = { CXCursor_TranslationUnit, 0, { 0, 0, TU } };
- return Result;
+ ASTUnit *CXXUnit = static_cast<ASTUnit*>(TU->TUData);
+ return MakeCXCursor(CXXUnit->getASTContext().getTranslationUnitDecl(), TU);
}
} // end: extern "C"