diff options
author | Steve Naroff <snaroff@apple.com> | 2009-09-11 00:12:01 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-09-11 00:12:01 +0000 |
commit | 8b26cbd4e4c01cb7a06ec2f794f2fce3b58cf4d0 (patch) | |
tree | 11395a4460738b58ad89aae9fb409d4429a878ff | |
parent | 1860a31edf826bc4001e153f1a8c10e17d97af87 (diff) |
Make sure ObjCInterfaceDecl's that are forward declared always contain a valid location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81487 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 6 | ||||
-rw-r--r-- | tools/c-index-test/c-index-test.c | 10 |
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 5b52ba9c8c..43d38f0679 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -111,6 +111,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, } else { IDecl->setLocation(AtInterfaceLoc); IDecl->setForwardDecl(false); + IDecl->setClassLoc(ClassLoc); } } else { IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtInterfaceLoc, @@ -1141,7 +1142,10 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc, 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); } diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 6db4898b08..101d71223a 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -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 @@ static void DeclVisitor(CXDecl Dcl, CXCursor Cursor, CXClientData Filter) { 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 @@ static void TranslationUnitVisitor(CXTranslationUnit Unit, CXCursor Cursor, { 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)); |