[clang][NFC] Move two declarations closer to their point of use
authorTimm Bäder <tbaeder@redhat.com>
Tue, 4 Jul 2023 18:31:07 +0000 (20:31 +0200)
committerTimm Bäder <tbaeder@redhat.com>
Wed, 5 Jul 2023 06:54:24 +0000 (08:54 +0200)
clang/lib/AST/ExprConstant.cpp

index 0946625..39e6b63 100644 (file)
@@ -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);