aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorTimm Bäder <tbaeder@redhat.com>2023-07-04 20:31:07 +0200
committerTimm Bäder <tbaeder@redhat.com>2023-07-05 08:54:24 +0200
commit3ec12740d0bc1b14bcafb8c9ece9e679f6957e9a (patch)
tree9de917b0cd40844ff77dbc7408abf0f5609f969b /clang/lib
parentbb566b652f7da5a96dbc694686bfea9ee54806b3 (diff)
downloadllvm-3ec12740d0bc1b14bcafb8c9ece9e679f6957e9a.zip
llvm-3ec12740d0bc1b14bcafb8c9ece9e679f6957e9a.tar.gz
llvm-3ec12740d0bc1b14bcafb8c9ece9e679f6957e9a.tar.bz2
[clang][NFC] Move two declarations closer to their point of use
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ExprConstant.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 0946625..39e6b63 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -15477,9 +15477,6 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx,
Info.setEvaluatingDecl(VD, Value);
Info.InConstantContext = IsConstantInitialization;
- SourceLocation DeclLoc = VD->getLocation();
- QualType DeclTy = VD->getType();
-
if (Info.EnableNewConstInterp) {
auto &InterpCtx = const_cast<ASTContext &>(Ctx).getInterpContext();
if (!InterpCtx.evaluateAsInitializer(Info, VD, Value))
@@ -15500,6 +15497,9 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx,
if (!Info.discardCleanups())
llvm_unreachable("Unhandled cleanup; missing full expression marker?");
}
+
+ SourceLocation DeclLoc = VD->getLocation();
+ QualType DeclTy = VD->getType();
return CheckConstantExpression(Info, DeclLoc, DeclTy, Value,
ConstantExprKind::Normal) &&
CheckMemoryLeaks(Info);