================
@@ -29,29 +29,24 @@ class StoreToImmutableChecker : public Checker<check::Bind> 
{
   void checkBind(SVal Loc, SVal Val, const Stmt *S, CheckerContext &C) const;
 
 private:
-  bool isConstVariable(const MemRegion *MR, CheckerContext &C) const;
+  bool isEffectivelyConstRegion(const MemRegion *MR, CheckerContext &C) const;
   bool isConstQualifiedType(const MemRegion *MR, CheckerContext &C) const;
 };
 } // end anonymous namespace
 
-bool StoreToImmutableChecker::isConstVariable(const MemRegion *MR,
-                                              CheckerContext &C) const {
+static bool isEffectivelyConstRegionAux(const MemRegion *MR,
+                                        CheckerContext &C) {
   // Check if the region is in the global immutable space
   const MemSpaceRegion *MS = MR->getMemorySpace(C.getState());
   if (isa<GlobalImmutableSpaceRegion>(MS))
     return true;
 
-  // Check if this is a VarRegion with a const-qualified type
-  if (const VarRegion *VR = dyn_cast<VarRegion>(MR)) {
-    const VarDecl *VD = VR->getDecl();
-    if (VD && VD->getType().isConstQualified())
-      return true;
-  }
-
-  // Check if this is a FieldRegion with a const-qualified type
-  if (const FieldRegion *FR = dyn_cast<FieldRegion>(MR)) {
-    const FieldDecl *FD = FR->getDecl();
-    if (FD && FD->getType().isConstQualified())
+  // Check if this is a TypedRegion with a const-qualified type
+  if (const TypedRegion *TR = dyn_cast<TypedRegion>(MR)) {
----------------
gamesh411 wrote:

Fixed

https://github.com/llvm/llvm-project/pull/150417
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to