Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() and getCurMethodDecl() that return the appropriate Decl through CurContext.

llvm-svn: 52852
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index d8f213a..a1ec7d9 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/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;
 }
-
-