[cfe-commits] r155858 - in /cfe/trunk: lib/Sema/SemaCodeComplete.cpp tools/libclang/CIndex.cpp
Douglas Gregor
dgregor at apple.com
Mon Apr 30 16:41:16 PDT 2012
Author: dgregor
Date: Mon Apr 30 18:41:16 2012
New Revision: 155858
URL: http://llvm.org/viewvc/llvm-project?rev=155858&view=rev
Log:
clang_getCursorLexicalParent should return a translation unit cursor for declarations at the global scope, from Evan P. Fixes PR9083.
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/tools/libclang/CIndex.cpp
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=155858&r1=155857&r2=155858&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Mon Apr 30 18:41:16 2012
@@ -2842,6 +2842,7 @@
case Decl::ClassTemplatePartialSpecialization:
return CXCursor_ClassTemplatePartialSpecialization;
case Decl::UsingDirective: return CXCursor_UsingDirective;
+ case Decl::TranslationUnit: return CXCursor_TranslationUnit;
case Decl::Using:
case Decl::UnresolvedUsingValue:
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=155858&r1=155857&r2=155858&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Mon Apr 30 18:41:16 2012
@@ -2831,8 +2831,8 @@
}
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"
More information about the cfe-commits
mailing list