[clang] c42bc2e - [clang][NFC] Make some local pointers const

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 15 01:57:43 PDT 2024


Author: Timm Bäder
Date: 2024-03-15T09:57:27+01:00
New Revision: c42bc2ea8f66def31ca9a381e995ec61e9fa9b05

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

LOG: [clang][NFC] Make some local pointers const

The function returns a const Expr* anyway.

Added: 
    

Modified: 
    clang/lib/AST/ExprConstant.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index b154a196e11c7d..7137efb7876de2 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -11858,8 +11858,8 @@ static QualType getObjectType(APValue::LValueBase B) {
 static const Expr *ignorePointerCastsAndParens(const Expr *E) {
   assert(E->isPRValue() && E->getType()->hasPointerRepresentation());
 
-  auto *NoParens = E->IgnoreParens();
-  auto *Cast = dyn_cast<CastExpr>(NoParens);
+  const Expr *NoParens = E->IgnoreParens();
+  const auto *Cast = dyn_cast<CastExpr>(NoParens);
   if (Cast == nullptr)
     return NoParens;
 
@@ -11870,7 +11870,7 @@ static const Expr *ignorePointerCastsAndParens(const Expr *E) {
       CastKind != CK_AddressSpaceConversion)
     return NoParens;
 
-  auto *SubExpr = Cast->getSubExpr();
+  const auto *SubExpr = Cast->getSubExpr();
   if (!SubExpr->getType()->hasPointerRepresentation() || !SubExpr->isPRValue())
     return NoParens;
   return ignorePointerCastsAndParens(SubExpr);


        


More information about the cfe-commits mailing list