aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-08-19 16:06:57 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-08-19 16:06:57 +0000
commit3dbf2f5f00cfc8b25318c119c0d39f4a49d15ebe (patch)
tree1e9c25554590b456f7da954568b23066272ddebd /lib/Parse/Parser.cpp
parent00fd773ae92aa452be1bb139a186599b2c43531a (diff)
objective-c: Bring objective-c handling of decl context
to modernity. Instead of passing down individual context objects from parser to sema, establish decl context in parser and have sema access current context as needed. I still need to take of Doug's comment for minor cleanups. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138040 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r--lib/Parse/Parser.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 5bb4165fbb..d7e7d4b081 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -811,7 +811,16 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsedAttributes &attrs,
AccessSpecifier AS) {
ParsingDeclSpec DS(*this);
DS.takeAttributesFrom(attrs);
- return ParseDeclarationOrFunctionDefinition(DS, AS);
+ Decl *DC = getObjCDeclContext();
+ if (DC)
+ // Must temporarily exit the objective-c container scope for
+ // parsing c constructs and re-enter objc container scope
+ // afterwards.
+ Actions.ActOnObjCContainerFinishDefinition(DC);
+ DeclGroupPtrTy resPtrTy = ParseDeclarationOrFunctionDefinition(DS, AS);
+ if (DC)
+ Actions.ActOnObjCContainerStartDefinition(DC);
+ return resPtrTy;
}
/// ParseFunctionDefinition - We parsed and verified that the specified