[clang] [analyzer] Improve handling of placement new in `PointerArith` (PR #155855)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 28 09:51:19 PDT 2025


Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/155855 at github.com>


================
@@ -165,3 +165,124 @@ void LValueToRValueBitCast_dumps(void *p, char (*array)[8]) {
 unsigned long ptr_arithmetic(void *p) {
   return __builtin_bit_cast(unsigned long, p) + 1; // no-crash
 }
+
+
+void escape(int*);
+
+struct AllocOpaqueFlag {};
+
+void* operator new(unsigned long, void *ptr) noexcept { return ptr; }
+void* operator new(unsigned long, void *ptr, AllocOpaqueFlag const&) noexcept { return ptr; }
----------------
steakhal wrote:

I was expecting the AllocOpaqueFlag overloads to be opaque.

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


More information about the cfe-commits mailing list