[clang] b0ac829 - [clang][AST][NFC] const-qualify a few locals in isPlaceholderVar

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 19 00:46:25 PST 2023


Author: Timm Bäder
Date: 2023-12-19T09:46:06+01:00
New Revision: b0ac829d7180e1d669ae218fef8d3f4da70394ed

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

LOG: [clang][AST][NFC] const-qualify a few locals in isPlaceholderVar

Added: 
    

Modified: 
    clang/lib/AST/Decl.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 527ea6042daa03..fbd5ff9a2ecf22 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1088,11 +1088,11 @@ bool NamedDecl::isPlaceholderVar(const LangOptions &LangOpts) const {
     return false;
   if (isa<FieldDecl>(this))
     return true;
-  if (auto *IFD = dyn_cast<IndirectFieldDecl>(this)) {
+  if (const auto *IFD = dyn_cast<IndirectFieldDecl>(this)) {
     if (!getDeclContext()->isFunctionOrMethod() &&
         !getDeclContext()->isRecord())
       return false;
-    VarDecl *VD = IFD->getVarDecl();
+    const VarDecl *VD = IFD->getVarDecl();
     return !VD || VD->getStorageDuration() == SD_Automatic;
   }
   // and it declares a variable with automatic storage duration
@@ -1105,7 +1105,7 @@ bool NamedDecl::isPlaceholderVar(const LangOptions &LangOpts) const {
   }
   if (const auto *BD = dyn_cast<BindingDecl>(this);
       BD && getDeclContext()->isFunctionOrMethod()) {
-    VarDecl *VD = BD->getHoldingVar();
+    const VarDecl *VD = BD->getHoldingVar();
     return !VD || VD->getStorageDuration() == StorageDuration::SD_Automatic;
   }
   return false;


        


More information about the cfe-commits mailing list