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/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index d8f213a..a1ec7d9 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -626,21 +626,24 @@
 Action::StmtResult
 Sema::ActOnReturnStmt(SourceLocation ReturnLoc, ExprTy *rex) {
   Expr *RetValExp = static_cast<Expr *>(rex);
-  QualType FnRetType = CurFunctionDecl ? CurFunctionDecl->getResultType() : 
-                                         CurMethodDecl->getResultType();
+  QualType FnRetType =
+        getCurFunctionDecl() ? getCurFunctionDecl()->getResultType() : 
+                               getCurMethodDecl()->getResultType();
 
   if (FnRetType->isVoidType()) {
     if (RetValExp) // C99 6.8.6.4p1 (ext_ since GCC warns)
       Diag(ReturnLoc, diag::ext_return_has_expr,
-           (CurFunctionDecl ? CurFunctionDecl->getIdentifier()->getName() :
-            CurMethodDecl->getSelector().getName()),
+           ( getCurFunctionDecl() ?
+                getCurFunctionDecl()->getIdentifier()->getName() :
+                getCurMethodDecl()->getSelector().getName()       ),
            RetValExp->getSourceRange());
     return new ReturnStmt(ReturnLoc, RetValExp);
   } else {
     if (!RetValExp) {
-      const char *funcName = CurFunctionDecl ? 
-                               CurFunctionDecl->getIdentifier()->getName() : 
-                               CurMethodDecl->getSelector().getName().c_str();
+      const char *funcName =
+                getCurFunctionDecl() ? 
+                   getCurFunctionDecl()->getIdentifier()->getName() :
+                   getCurMethodDecl()->getSelector().getName().c_str();
       if (getLangOptions().C99)  // C99 6.8.6.4p1 (ext_ since GCC warns)
         Diag(ReturnLoc, diag::ext_return_missing_expr, funcName);
       else  // C90 6.6.6.4p4
@@ -816,5 +819,3 @@
     static_cast<Stmt*>(SynchExpr), static_cast<Stmt*>(SynchBody));
   return SS;
 }
-
-