[cfe-commits] r93343 - in /cfe/trunk: include/clang-c/Index.h tools/CIndex/CIndex.cpp

Ted Kremenek kremenek at apple.com
Wed Jan 13 11:59:20 PST 2010


Author: kremenek
Date: Wed Jan 13 13:59:20 2010
New Revision: 93343

URL: http://llvm.org/viewvc/llvm-project?rev=93343&view=rev
Log:
Add 'referringDecl' field to CXCursor to prepare the way to better model declaration references from other delcarations.

Modified:
    cfe/trunk/include/clang-c/Index.h
    cfe/trunk/tools/CIndex/CIndex.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=93343&r1=93342&r2=93343&view=diff

==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Wed Jan 13 13:59:20 2010
@@ -139,6 +139,7 @@
   enum CXCursorKind kind;
   CXDecl decl;
   CXStmt stmt; /* expression reference */
+  CXDecl referringDecl;
 } CXCursor;  
 
 /* A unique token for looking up "visible" CXDecls from a CXTranslationUnit. */

Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=93343&r1=93342&r2=93343&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Wed Jan 13 13:59:20 2010
@@ -188,7 +188,7 @@
     if (ND->isImplicit())
       return;
 
-    CXCursor C = { CK, ND, 0 };
+    CXCursor C = { CK, ND, 0, 0 };
     Callback(Root, C, CData);
   }
 
@@ -289,7 +289,7 @@
     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 @@
   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 @@
   if (Dcl) {
     if (Stm) {
       if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Stm)) {
-        CXCursor C = { TranslateDeclRefExpr(DRE), Dcl, Stm };
+        CXCursor C = { TranslateDeclRefExpr(DRE), Dcl, Stm, 0 };
         return C;
       } else if (ObjCMessageExpr *MExp = dyn_cast<ObjCMessageExpr>(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<ObjCInterfaceDecl>(Dcl)) {
-        CXCursor C = { CXCursor_ObjCClassRef, Dcl, ALoc.getParentDecl() };
+        CXCursor C = { CXCursor_ObjCClassRef, Dcl, ALoc.getParentDecl(), 0 };
         return C;
       }
       if (isa<ObjCProtocolDecl>(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 @@
   assert(AnonDecl && "Passed null CXDecl");
   NamedDecl *ND = static_cast<NamedDecl *>(AnonDecl);
 
-  CXCursor C = { TranslateKind(ND), ND, 0 };
+  CXCursor C = { TranslateKind(ND), ND, 0, 0 };
   return C;
 }
 





More information about the cfe-commits mailing list