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
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 5b52ba9..43d38f0 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -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);
}
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 6db4898..101d712 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 @@
{
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));