objc - use existing API for temporary switch of
objc's decl context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138267 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index a5fb31a..46f6456 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -235,8 +235,8 @@
PIkind);
// Must re-establish the context from class extension to primary
// class context.
- ActOnObjCContainerFinishDefinition(CDecl);
- ActOnObjCContainerStartDefinition(CCPrimary);
+ ContextRAII SavedContext(*this, CCPrimary);
+
Decl *ProtocolPtrTy =
ActOnProperty(S, AtLoc, FD, ProtocolPropertyODS,
PIDecl->getGetterName(),
@@ -244,9 +244,6 @@
isOverridingProperty,
MethodImplKind,
/* lexicalDC = */ CDecl);
- // restore class extension context.
- ActOnObjCContainerFinishDefinition(CCPrimary);
- ActOnObjCContainerStartDefinition(CDecl);
PIDecl = cast<ObjCPropertyDecl>(ProtocolPtrTy);
}
PIDecl->makeitReadWriteAttribute();