[clang] [analyzer] Fix getElementRegion to retain address space information (PR #151249)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 30 06:52:38 PDT 2025


================
@@ -8274,6 +8275,15 @@ inline void QualType::removeLocalVolatile() {
   removeLocalFastQualifiers(Qualifiers::Volatile);
 }
 
+inline QualType QualType::removeNonAddressSpaceQualifiers() {
+  if (getQualifiers().hasTargetSpecificAddressSpace()) {
+    removeLocalFastQualifiers();
+  } else {
+    return getCanonicalType().getUnqualifiedType();
+  }
+  return *this;
+}
----------------
NagyDonat wrote:

I don't think that this method would be used outside of the static analyzer, so as @steakhal also suggested I think this should be a static function in `MemRegion.cpp` (and not a method of `QualType` which is used everywhere in clang).

https://github.com/llvm/llvm-project/pull/151249


More information about the cfe-commits mailing list