[cfe-commits] r81487 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp tools/c-index-test/c-index-test.c

Steve Naroff snaroff at apple.com
Thu Sep 10 17:12:01 PDT 2009


Author: snaroff
Date: Thu Sep 10 19:12:01 2009
New Revision: 81487

URL: http://llvm.org/viewvc/llvm-project?rev=81487&view=rev
Log:
Make sure ObjCInterfaceDecl's that are forward declared always contain a valid location.

Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/tools/c-index-test/c-index-test.c

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=81487&r1=81486&r2=81487&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Thu Sep 10 19:12:01 2009
@@ -111,6 +111,7 @@
     } else {
       IDecl->setLocation(AtInterfaceLoc);
       IDecl->setForwardDecl(false);
+      IDecl->setClassLoc(ClassLoc);
     }
   } else {
     IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtInterfaceLoc,
@@ -1141,7 +1142,10 @@
     ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
     if (!IDecl) {  // Not already seen?  Make a forward decl.
       IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtClassLoc,
-                                        IdentList[i], SourceLocation(), true);
+                                        IdentList[i],
+                                        // FIXME: need to get the 'real'
+                                        // identifier loc from the parser.
+                                        AtClassLoc, true);
       PushOnScopeChains(IDecl, TUScope);
     }
 

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=81487&r1=81486&r2=81487&view=diff

==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Thu Sep 10 19:12:01 2009
@@ -5,7 +5,7 @@
 #include <string.h>
 
 static void PrintCursor(CXCursor Cursor) {
-  printf("%s => %s\n", clang_getCursorKindSpelling(Cursor.kind),
+  printf("%s => %s ", clang_getCursorKindSpelling(Cursor.kind),
                        clang_getCursorSpelling(Cursor));
 }
 
@@ -13,8 +13,8 @@
 {
   if (!Filter || (Cursor.kind == *(enum CXCursorKind *)Filter)) {
     PrintCursor(Cursor);
-    printf("  Context: %s\n", clang_getDeclSpelling(Dcl));
-    printf("  Source:  %s (%d:%d)\n", clang_getCursorSource(Cursor),
+    printf("(Context: %s", clang_getDeclSpelling(Dcl));
+    printf(" Source:  %s (%d:%d))\n", clang_getCursorSource(Cursor),
                                       clang_getCursorLine(Cursor),
                                       clang_getCursorColumn(Cursor));
   }
@@ -24,8 +24,8 @@
 {
   if (!Filter || (Cursor.kind == *(enum CXCursorKind *)Filter)) {
     PrintCursor(Cursor);
-    printf("  Context: %s\n", clang_getTranslationUnitSpelling(Unit));
-    printf("  Source:  %s (%d:%d)\n", clang_getCursorSource(Cursor),
+    printf("(Context: %s", clang_getTranslationUnitSpelling(Unit));
+    printf(" Source:  %s (%d:%d))\n", clang_getCursorSource(Cursor),
                                       clang_getCursorLine(Cursor),
                                       clang_getCursorColumn(Cursor));
 





More information about the cfe-commits mailing list