Mark a struct definition in an objc container with the TopLevelDeclInObjCContainer bit.
Fixes accurately getting a cursor inside an objc container containing a struct definition,
from a PCH/preamble file.
rdar://12584613
llvm-svn: 173811
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 56db548..3350640 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9761,7 +9761,11 @@
// Exit this scope of this tag's definition.
PopDeclContext();
-
+
+ if (getCurLexicalContext()->isObjCContainer() &&
+ Tag->getDeclContext()->isFileContext())
+ Tag->setTopLevelDeclInObjCContainer();
+
// Notify the consumer that we've defined a tag.
Consumer.HandleTagDeclDefinition(Tag);
}