aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-28 06:07:14 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-28 06:07:14 +0000
commit53d0ea5f5bfa647ec23418bf3a3b7c183b51e4bd (patch)
tree588340921cc284ce356556588d0916c8f422d298 /lib/Sema/SemaStmt.cpp
parent0d52da1812bfc70fd7a577966104c1c9d03143f6 (diff)
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
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index d8f213a973..a1ec7d9930 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -626,21 +626,24 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) {
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 @@ Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, ExprTy *SynchExpr,
static_cast<Stmt*>(SynchExpr), static_cast<Stmt*>(SynchBody));
return SS;
}
-
-