[clang] 929e60b - [analyzer] Relax constraints on const qualified regions

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 08:08:50 PDT 2022


Author: Balazs Benics
Date: 2022-06-15T17:08:27+02:00
New Revision: 929e60b6bd2f463321b6e98db85a3d9c89236996

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

LOG: [analyzer] Relax constraints on const qualified regions

The arithmetic restriction seems to be artificial.
The comment below seems to be stale.
Thus, we remove both.

Depends on D127306.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D127763

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Core/MemRegion.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
index 96a985381acc..f0cda835e07c 100644
--- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -975,9 +975,7 @@ const VarRegion *MemRegionManager::getVarRegion(const VarDecl *D,
   if (D->hasGlobalStorage() && !D->isStaticLocal()) {
     QualType Ty = D->getType();
     assert(!Ty.isNull());
-    if (Ty.isConstQualified() && Ty->isArithmeticType()) {
-      // TODO: We could walk the complex types here and see if everything is
-      // constified.
+    if (Ty.isConstQualified()) {
       sReg = getGlobalsRegion(MemRegion::GlobalImmutableSpaceRegionKind);
     } else if (Ctx.getSourceManager().isInSystemHeader(D->getLocation())) {
       sReg = getGlobalsRegion(MemRegion::GlobalSystemSpaceRegionKind);


        


More information about the cfe-commits mailing list