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/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 0b048b0..df75109 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1463,7 +1463,7 @@
 }
 
 Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
-  assert(CurFunctionDecl == 0 && "Function parsing confused");
+  assert(getCurFunctionDecl() == 0 && "Function parsing confused");
   assert(D.getTypeObject(0).Kind == DeclaratorChunk::Function &&
          "Not a function declarator!");
   DeclaratorChunk::FunctionTypeInfo &FTI = D.getTypeObject(0).Fun;
@@ -1512,7 +1512,6 @@
   }
   Decl *decl = static_cast<Decl*>(ActOnDeclarator(GlobalScope, D, 0));
   FunctionDecl *FD = cast<FunctionDecl>(decl);
-  CurFunctionDecl = FD;
   PushDeclContext(FD);
     
   // Check the validity of our function parameters
@@ -1533,11 +1532,9 @@
   Decl *dcl = static_cast<Decl *>(D);
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(dcl)) {
     FD->setBody((Stmt*)Body);
-    assert(FD == CurFunctionDecl && "Function parsing confused");
-    CurFunctionDecl = 0;
+    assert(FD == getCurFunctionDecl() && "Function parsing confused");
   } else if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(dcl)) {
     MD->setBody((Stmt*)Body);
-    CurMethodDecl = 0;
   }  
   PopDeclContext();
   // Verify and clean out per-function state.