[clang] 044be8f - [clang][Interp][NFC] Add some missing const qualifiers

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 4 07:17:05 PDT 2023


Author: Timm Bäder
Date: 2023-07-04T16:16:17+02:00
New Revision: 044be8f5d12fcb35cb5c30fa05d95b1abbf19232

URL: https://github.com/llvm/llvm-project/commit/044be8f5d12fcb35cb5c30fa05d95b1abbf19232
DIFF: https://github.com/llvm/llvm-project/commit/044be8f5d12fcb35cb5c30fa05d95b1abbf19232.diff

LOG: [clang][Interp][NFC] Add some missing const qualifiers

Added: 
    

Modified: 
    clang/lib/AST/Interp/Interp.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Interp.cpp b/clang/lib/AST/Interp/Interp.cpp
index d68accdf3bf850..e906f65c371c27 100644
--- a/clang/lib/AST/Interp/Interp.cpp
+++ b/clang/lib/AST/Interp/Interp.cpp
@@ -127,7 +127,7 @@ bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
     return true;
 
   if (!S.checkingPotentialConstantExpression()) {
-    auto *VD = Ptr.getDeclDesc()->asValueDecl();
+    const auto *VD = Ptr.getDeclDesc()->asValueDecl();
     const SourceInfo &Loc = S.Current->getSource(OpPC);
     S.FFDiag(Loc, diag::note_constexpr_ltor_non_constexpr, 1) << VD;
     S.Note(VD->getLocation(), diag::note_declared_at);
@@ -314,9 +314,9 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
 
       // If this function is not constexpr because it is an inherited
       // non-constexpr constructor, diagnose that directly.
-      auto *CD = dyn_cast<CXXConstructorDecl>(DiagDecl);
+      const auto *CD = dyn_cast<CXXConstructorDecl>(DiagDecl);
       if (CD && CD->isInheritingConstructor()) {
-        auto *Inherited = CD->getInheritedConstructor().getConstructor();
+        const auto *Inherited = CD->getInheritedConstructor().getConstructor();
         if (!Inherited->isConstexpr())
           DiagDecl = CD = Inherited;
       }
@@ -358,7 +358,7 @@ bool CheckThis(InterpState &S, CodePtr OpPC, const Pointer &This) {
   const SourceInfo &Loc = S.Current->getSource(OpPC);
 
   bool IsImplicit = false;
-  if (auto *E = dyn_cast_if_present<CXXThisExpr>(Loc.asExpr()))
+  if (const auto *E = dyn_cast_if_present<CXXThisExpr>(Loc.asExpr()))
     IsImplicit = E->isImplicit();
 
   if (S.getLangOpts().CPlusPlus11)
@@ -402,7 +402,7 @@ static bool CheckArrayInitialized(InterpState &S, CodePtr OpPC,
       Pointer ElemPtr = BasePtr.atIndex(I).narrow();
       Result &= CheckFieldsInitialized(S, OpPC, ElemPtr, R);
     }
-  } else if (auto *ElemCAT = dyn_cast<ConstantArrayType>(ElemType)) {
+  } else if (const auto *ElemCAT = dyn_cast<ConstantArrayType>(ElemType)) {
     for (size_t I = 0; I != NumElems; ++I) {
       Pointer ElemPtr = BasePtr.atIndex(I).narrow();
       Result &= CheckArrayInitialized(S, OpPC, ElemPtr, ElemCAT);


        


More information about the cfe-commits mailing list