diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-19 22:07:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-19 22:07:56 +0000 |
commit | accb183371d347130ae51d207336aceefbcae2dc (patch) | |
tree | 4cc1b717a70f0cdca26bc8fc5946ac10c0d5b5ee /clang/tools/CIndex/CIndex.cpp | |
parent | dc50e5d128f98081e3fda1bb42a6e49150ba5ffc (diff) | |
download | bcm5719-llvm-accb183371d347130ae51d207336aceefbcae2dc.tar.gz bcm5719-llvm-accb183371d347130ae51d207336aceefbcae2dc.zip |
Introduce the notion of an "unexposed" declaration into the CIndex
API. This is a catch-all for any declaration known to Clang but not
specifically part of the CIndex API. We'll use the same approach with
expressions, statements, references, etc., as needed.
llvm-svn: 93924
Diffstat (limited to 'clang/tools/CIndex/CIndex.cpp')
-rw-r--r-- | clang/tools/CIndex/CIndex.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index a7cbb8a4fc7..b4759a51275 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/tools/CIndex/CIndex.cpp @@ -208,7 +208,7 @@ static enum CXCursorKind TranslateDeclRefExpr(DeclRefExpr *DRE) { else if (isa<EnumConstantDecl>(D)) return CXCursor_EnumConstantRef; else - return CXCursor_NotImplemented; + return CXCursor_UnexposedDecl; } // Translation Unit Visitor. @@ -712,7 +712,10 @@ static const FileEntry *getFileEntryFromSourceLocation(SourceManager &SMgr, extern "C" { CXString clang_getDeclSpelling(CXDecl AnonDecl) { assert(AnonDecl && "Passed null CXDecl"); - NamedDecl *ND = static_cast<NamedDecl *>(AnonDecl); + Decl *D = static_cast<Decl *>(AnonDecl); + NamedDecl *ND = dyn_cast<NamedDecl>(D); + if (!ND) + return CIndexer::createCXString(""); if (ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(ND)) return CIndexer::createCXString(OMD->getSelector().getAsString().c_str(), @@ -871,6 +874,7 @@ const char *clang_getCursorKindSpelling(enum CXCursorKind Kind) { case CXCursor_ObjCClassMethodDecl: return "ObjCClassMethodDecl"; case CXCursor_ObjCImplementationDecl: return "ObjCImplementationDecl"; case CXCursor_ObjCCategoryImplDecl: return "ObjCCategoryImplDecl"; + case CXCursor_UnexposedDecl: return "UnexposedDecl"; case CXCursor_ObjCSuperClassRef: return "ObjCSuperClassRef"; case CXCursor_ObjCProtocolRef: return "ObjCProtocolRef"; case CXCursor_ObjCClassRef: return "ObjCClassRef"; |