[clang] [analyzer] Retain address space information in getElementRegion (PR #151370)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 1 07:33:24 PDT 2025


=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/151370 at github.com>


================
@@ -1219,6 +1219,16 @@ MemRegionManager::getElementRegion(QualType elementType, NonLoc Idx,
                                    const ASTContext &Ctx) {
   QualType T = Ctx.getCanonicalType(elementType).getUnqualifiedType();
 
+  // The address space must be preserved because some target-specific address
+  // spaces influence the size of the pointer value which is represented by the
+  // element region.
+  LangAS AS = elementType.getAddressSpace();
+  if (AS != LangAS::Default) {
----------------
steakhal wrote:

Its okay.

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


More information about the cfe-commits mailing list