[llvm-branch-commits] Add pointer field protection feature. (PR #133538)

Oliver Hunt via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed May 14 17:27:27 PDT 2025


================
@@ -362,6 +362,17 @@ class LangOptionsBase {
     BKey
   };
 
+  enum class PointerFieldProtectionKind {
----------------
ojhunt wrote:

I'm not sure I like this being solely a global decision - it makes custom allocators much harder, and it makes it hard for allocators that have different policies, e.g 

```cpp
struct ImportantStruct {
   void *operator new(size_t) { /*tagged allocator*/ }
 };

struct BoringStruct {
   ...
};

struct SomeOtherStruct {
  ImportantStruct *important; // should be tagged pointer
  BoringString *lessImportant; // should be a non tagged pointer
};
```

This would again require a struct attribute to indicate the pointer policy





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


More information about the llvm-branch-commits mailing list