Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() and getCurMethodDecl() that return the appropriate Decl through CurContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52852 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 5ac4931..09f1179 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -21,7 +21,7 @@
/// ObjCActOnStartOfMethodDef - This routine sets up parameters; invisible
/// and user declared, in the method definition's AST.
void Sema::ObjCActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) {
- assert(CurMethodDecl == 0 && "Method parsing confused");
+ assert(getCurMethodDecl() == 0 && "Method parsing confused");
ObjCMethodDecl *MDecl = dyn_cast<ObjCMethodDecl>(static_cast<Decl *>(D));
assert(MDecl != 0 && "Not a method declarator!");
@@ -32,7 +32,6 @@
AddFactoryMethodToGlobalPool(MDecl);
// Allow all of Sema to see that we are entering a method definition.
- CurMethodDecl = MDecl;
PushDeclContext(MDecl);
// Create Decl objects for each parameter, entrring them in the scope for
@@ -53,11 +52,11 @@
}
} else // we have a factory method.
selfTy = Context.getObjCClassType();
- CurMethodDecl->setSelfDecl(CreateImplicitParameter(FnBodyScope,
+ getCurMethodDecl()->setSelfDecl(CreateImplicitParameter(FnBodyScope,
PI.Ident, PI.IdentLoc, selfTy));
PI.Ident = &Context.Idents.get("_cmd");
- CurMethodDecl->setCmdDecl(CreateImplicitParameter(FnBodyScope,
+ getCurMethodDecl()->setCmdDecl(CreateImplicitParameter(FnBodyScope,
PI.Ident, PI.IdentLoc, Context.getObjCSelType()));
// Introduce all of the other parameters into this scope.
@@ -1191,4 +1190,3 @@
return PIDecl;
}
-