summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-09 21:30:38 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-09 21:30:38 +0000
commit530805711f3a08bf42b080632fd89029ac98a13e (patch)
tree130c8848df962294475f5e8a686e08b7fcbaa69e
parent06aa50417d79b0bf1e9bf90dbf2e2168436f79a9 (diff)
downloadbcm5719-llvm-530805711f3a08bf42b080632fd89029ac98a13e.tar.gz
bcm5719-llvm-530805711f3a08bf42b080632fd89029ac98a13e.zip
When upgrading an Objective-C class from a forward declaration to a
full-fledged @interface, be sure that the declaration has the right lexical context. <rdar://problem/7827709> llvm-svn: 100903
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp1
-rw-r--r--clang/test/SemaObjCXX/linkage-spec.mm8
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 7e5e40c5626..eb3f4222b69 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -98,6 +98,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
// Since this ObjCInterfaceDecl was created by a forward declaration,
// we now add it to the DeclContext since it wasn't added before
// (see ActOnForwardClassDeclaration).
+ IDecl->setLexicalDeclContext(CurContext);
CurContext->addDecl(IDecl);
if (AttrList)
diff --git a/clang/test/SemaObjCXX/linkage-spec.mm b/clang/test/SemaObjCXX/linkage-spec.mm
index b4e809eee16..1454e6a6782 100644
--- a/clang/test/SemaObjCXX/linkage-spec.mm
+++ b/clang/test/SemaObjCXX/linkage-spec.mm
@@ -2,3 +2,11 @@
extern "C" {
@class Protocol;
}
+
+// <rdar://problem/7827709>
+extern "C" {
+@class I;
+}
+
+@interface I
+@end
OpenPOWER on IntegriCloud