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

Florian Mayer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 13 08:30:15 PST 2026


================
@@ -4761,6 +4762,36 @@ void CodeGenModule::emitMultiVersionFunctions() {
     emitMultiVersionFunctions();
 }
 
+llvm::GlobalValue *
+CodeGenModule::getPFPDeactivationSymbol(const FieldDecl *FD) {
+  std::string DSName = "__pfp_ds_" + getPFPFieldName(FD);
+  llvm::GlobalValue *DS = TheModule.getNamedValue(DSName);
+  if (!DS) {
+    DS = new llvm::GlobalVariable(TheModule, Int8Ty, false,
+                                  llvm::GlobalVariable::ExternalWeakLinkage,
+                                  nullptr, DSName);
+    DS->setVisibility(llvm::GlobalValue::HiddenVisibility);
+  }
+  return DS;
+}
+
+void CodeGenModule::emitPFPFieldsWithEvaluatedOffset() {
+  llvm::Constant *Nop = llvm::ConstantExpr::getIntToPtr(
----------------
fmayer wrote:

add a comment for this magic value

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


More information about the llvm-branch-commits mailing list