summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 5aaa0dbc2f4..ec86b9f2a6b 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -505,14 +505,14 @@ Sema::ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc,
}
// Verify that this is in a function context.
- if (getCurFunctionDecl() == 0 && getCurMethodDecl() == 0)
+ if (getCurFunctionOrMethodDecl() == 0)
return Diag(Loc, diag::err_predef_outside_function);
// Pre-defined identifiers are of type char[x], where x is the length of the
// string.
unsigned Length;
- if (getCurFunctionDecl())
- Length = getCurFunctionDecl()->getIdentifier()->getLength();
+ if (FunctionDecl *FD = getCurFunctionDecl())
+ Length = FD->getIdentifier()->getLength();
else
Length = getCurMethodDecl()->getSynthesizedMethodSize();
@@ -1438,7 +1438,7 @@ ActOnCompoundLiteral(SourceLocation LParenLoc, TypeTy *Ty,
DeclarationName()))
return true;
- bool isFileScope = !getCurFunctionDecl() && !getCurMethodDecl();
+ bool isFileScope = getCurFunctionOrMethodDecl() == 0;
if (isFileScope) { // 6.5.2.5p3
if (CheckForConstantInitializer(literalExpr, literalType))
return true;
OpenPOWER on IntegriCloud