Author: Corentin Jabot
Date: 2022-09-10T19:10:23+02:00
New Revision: 0e8afddaa15fda1d50888b44695eecb89c0b1c0b

URL: 
https://github.com/llvm/llvm-project/commit/0e8afddaa15fda1d50888b44695eecb89c0b1c0b
DIFF: 
https://github.com/llvm/llvm-project/commit/0e8afddaa15fda1d50888b44695eecb89c0b1c0b.diff

LOG: [Clang] NFC: Remove duplicated variable def in 
CheckLValueConstantExpression

Added: 
    

Modified: 
    clang/lib/AST/ExprConstant.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index a5568e0158e33..26822a64b14c6 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -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;


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to