diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-22 17:59:19 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-22 17:59:19 +0000 |
commit | 9735c5e60027b26a809df19677ff16a4d13f1321 (patch) | |
tree | 0696384b97e6af066ef682983312fbc9214d3414 /lib/Parse/Parser.cpp | |
parent | 9a1ecf0522ccb7a45577f856150c15af0ee1df2a (diff) |
objc - Simplify switing objc decl context by using
a context switching object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r-- | lib/Parse/Parser.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index d7e7d4b081..0da2b4302c 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -811,16 +811,12 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsedAttributes &attrs, AccessSpecifier AS) { ParsingDeclSpec DS(*this); DS.takeAttributesFrom(attrs); - 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; + // Must temporarily exit the objective-c container scope for + // parsing c constructs and re-enter objc container scope + // afterwards. + ObjCDeclContextSwitch ObjCDC(*this); + + return ParseDeclarationOrFunctionDefinition(DS, AS); } /// ParseFunctionDefinition - We parsed and verified that the specified |