[Clang] NFC: Remove duplicated variable def in CheckLValueConstantExpression
authorCorentin Jabot <corentinjabot@gmail.com>
Sat, 10 Sep 2022 17:07:56 +0000 (19:07 +0200)
committerCorentin Jabot <corentinjabot@gmail.com>
Sat, 10 Sep 2022 17:10:23 +0000 (19:10 +0200)
clang/lib/AST/ExprConstant.cpp

index a5568e0..26822a6 100644 (file)
@@ -2174,12 +2174,10 @@ static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc,
   // assumed to be global here.
   if (!IsGlobalLValue(Base)) {
     if (Info.getLangOpts().CPlusPlus11) {
-      const ValueDecl *VD = Base.dyn_cast<const ValueDecl*>();
       Info.FFDiag(Loc, diag::note_constexpr_non_global, 1)
-        << IsReferenceType << !Designator.Entries.empty()
-        << !!VD << VD;
-
-      auto *VarD = dyn_cast_or_null<VarDecl>(VD);
+          << IsReferenceType << !Designator.Entries.empty() << !!BaseVD
+          << BaseVD;
+      auto *VarD = dyn_cast_or_null<VarDecl>(BaseVD);
       if (VarD && VarD->isConstexpr()) {
         // Non-static local constexpr variables have unintuitive semantics:
         //   constexpr int a = 1;