[PATCH] D127763: [analyzer] Relax constraints on const qualified regions

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 14 09:37:25 PDT 2022


steakhal created this revision.
steakhal added reviewers: NoQ, martong, xazax.hun.
Herald added subscribers: manas, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware.
Herald added a reviewer: Szelethus.
Herald added a project: All.
steakhal requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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

Depends on D127306 <https://reviews.llvm.org/D127306>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127763

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


Index: clang/lib/StaticAnalyzer/Core/MemRegion.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -975,9 +975,7 @@
   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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127763.436825.patch
Type: text/x-patch
Size: 768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220614/73b2f95d/attachment.bin>


More information about the cfe-commits mailing list