From: Ted Kremenek Date: Wed, 13 Jan 2010 19:59:20 +0000 (+0000) Subject: Add 'referringDecl' field to CXCursor to prepare the way to better model declaration... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b89e8f64e63aa1a76452e505c6432e0de93fa7cb;p=clang Add 'referringDecl' field to CXCursor to prepare the way to better model declaration references from other delcarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93343 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index 47f10e3663..f11a9eb76f 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -139,6 +139,7 @@ typedef struct { enum CXCursorKind kind; CXDecl decl; CXStmt stmt; /* expression reference */ + CXDecl referringDecl; } CXCursor; /* A unique token for looking up "visible" CXDecls from a CXTranslationUnit. */ diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp index ff8124de46..72d0837fd1 100644 --- a/tools/CIndex/CIndex.cpp +++ b/tools/CIndex/CIndex.cpp @@ -188,7 +188,7 @@ private: if (ND->isImplicit()) return; - CXCursor C = { CK, ND, 0 }; + CXCursor C = { CK, ND, 0, 0 }; Callback(Root, C, CData); } @@ -289,7 +289,7 @@ class CDeclVisitor : public DeclVisitor { if (ND->getPCHLevel() > MaxPCHLevel) return; - CXCursor C = { CK, ND, 0 }; + CXCursor C = { CK, ND, 0, 0 }; Callback(CDecl, C, CData); } public: @@ -931,7 +931,7 @@ CXCursor clang_getCursor(CXTranslationUnit CTUnit, const char *source_name, const FileEntry *File = FMgr.getFile(source_name, source_name+strlen(source_name)); if (!File) { - CXCursor C = { CXCursor_InvalidFile, 0, 0 }; + CXCursor C = { CXCursor_InvalidFile, 0, 0, 0 }; return C; } SourceLocation SLoc = @@ -951,28 +951,28 @@ CXCursor clang_getCursor(CXTranslationUnit CTUnit, const char *source_name, if (Dcl) { if (Stm) { if (DeclRefExpr *DRE = dyn_cast(Stm)) { - CXCursor C = { TranslateDeclRefExpr(DRE), Dcl, Stm }; + CXCursor C = { TranslateDeclRefExpr(DRE), Dcl, Stm, 0 }; return C; } else if (ObjCMessageExpr *MExp = dyn_cast(Stm)) { - CXCursor C = { CXCursor_ObjCSelectorRef, Dcl, MExp }; + CXCursor C = { CXCursor_ObjCSelectorRef, Dcl, MExp, 0 }; return C; } // Fall through...treat as a decl, not a ref. } if (ALoc.isNamedRef()) { if (isa(Dcl)) { - CXCursor C = { CXCursor_ObjCClassRef, Dcl, ALoc.getParentDecl() }; + CXCursor C = { CXCursor_ObjCClassRef, Dcl, ALoc.getParentDecl(), 0 }; return C; } if (isa(Dcl)) { - CXCursor C = { CXCursor_ObjCProtocolRef, Dcl, ALoc.getParentDecl() }; + CXCursor C = { CXCursor_ObjCProtocolRef, Dcl, ALoc.getParentDecl(), 0 }; return C; } } - CXCursor C = { TranslateKind(Dcl), Dcl, 0 }; + CXCursor C = { TranslateKind(Dcl), Dcl, 0, 0 }; return C; } - CXCursor C = { CXCursor_NoDeclFound, 0, 0 }; + CXCursor C = { CXCursor_NoDeclFound, 0, 0, 0 }; return C; } @@ -992,7 +992,7 @@ CXCursor clang_getCursorFromDecl(CXDecl AnonDecl) { assert(AnonDecl && "Passed null CXDecl"); NamedDecl *ND = static_cast(AnonDecl); - CXCursor C = { TranslateKind(ND), ND, 0 }; + CXCursor C = { TranslateKind(ND), ND, 0, 0 }; return C; }