From: Fariborz Jahanian Date: Tue, 30 Aug 2011 17:10:52 +0000 (+0000) Subject: objc - fixes a regression in declaring c decls nested in X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8cff36db2b6ec332ab39b1dbe7466e574a9362d;p=clang objc - fixes a regression in declaring c decls nested in 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 --- diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 9e2fb25947..5fd95f17fc 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -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 index 0000000000..70ca3a12cc --- /dev/null +++ b/test/SemaObjC/nested-typedef-decl.m @@ -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 +