diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-20 00:23:15 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-20 00:23:15 +0000 |
commit | d2fc7277be6aff4056db2b3e1ce9da73037ffc1d (patch) | |
tree | 4fdec740da084cf999cb6bede430416080aaa530 /clang/tools/CIndex/CXCursor.cpp | |
parent | 91970b4ea2fc6747de5f37b25ce0f5f044b1d224 (diff) | |
download | bcm5719-llvm-d2fc7277be6aff4056db2b3e1ce9da73037ffc1d.tar.gz bcm5719-llvm-d2fc7277be6aff4056db2b3e1ce9da73037ffc1d.zip |
Introduce a special cursor kind for the translation unit, to serve as
the root of the conceptual cursor hierarchy (just like we do with
declarations). This will be used when we get to unify
clang_loadTranslationUnit() and clang_loadDeclaration() into something
more generally useful.
llvm-svn: 93954
Diffstat (limited to 'clang/tools/CIndex/CXCursor.cpp')
-rw-r--r-- | clang/tools/CIndex/CXCursor.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/tools/CIndex/CXCursor.cpp b/clang/tools/CIndex/CXCursor.cpp index f13e2eea89f..7dd3ae9cc00 100644 --- a/clang/tools/CIndex/CXCursor.cpp +++ b/clang/tools/CIndex/CXCursor.cpp @@ -14,6 +14,7 @@ //===----------------------------------------------------------------------===// #include "CXCursor.h" +#include "clang/Frontend/ASTUnit.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/Expr.h" @@ -320,6 +321,10 @@ ASTContext &cxcursor::getCursorContext(CXCursor Cursor) { case CXCursor_UnexposedStmt: return static_cast<Decl *>(Cursor.data[0])->getASTContext(); + case CXCursor_TranslationUnit: { + ASTUnit *CXXUnit = static_cast<ASTUnit *>(Cursor.data[0]); + return CXXUnit->getASTContext(); + } } llvm_unreachable("No context available"); |