]> granicus.if.org Git - clang/commitdiff
objc - fixes a regression in declaring c decls nested in
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 30 Aug 2011 17:10:52 +0000 (17:10 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 30 Aug 2011 17:10:52 +0000 (17:10 +0000)
objective-c containers due to recent changes to objc decl
contexts. // rdar://10041908

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138803 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/SemaObjC/nested-typedef-decl.m [new file with mode: 0644]

index 9e2fb259476c7dd8b1ea6518f4cdfb57bd6003de..5fd95f17fc9fad29f4ca7e58bdddd0631b24f0c1 100644 (file)
@@ -759,6 +759,9 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(StmtVector &Stmts,
                                                 SourceLocation &DeclEnd,
                                           ParsedAttributesWithRange &attrs) {
   ParenBraceBracketBalancer BalancerRAIIObj(*this);
+  // Must temporarily exit the objective-c container scope for
+  // parsing c none objective-c decls.
+  ObjCDeclContextSwitch ObjCDC(*this);
   
   Decl *SingleDecl = 0;
   Decl *OwnedType = 0;
diff --git a/test/SemaObjC/nested-typedef-decl.m b/test/SemaObjC/nested-typedef-decl.m
new file mode 100644 (file)
index 0000000..70ca3a1
--- /dev/null
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -x objective-c -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
+// rdar://10041908
+
+@interface Bar {
+  struct _A *_hardlinkList;
+}
+@end
+@implementation Bar
+typedef struct _A {
+  int dev;
+  int inode;
+} A;
+
+- (void) idx:(int)idx ino:(int)ino dev:(int)dev
+{
+  _hardlinkList[idx].inode = ino;
+  _hardlinkList[idx].dev = dev;
+}
+@end
+