[clang] [Clang][attr] Add 'cfi_salt' attribute (PR #141846)
Bill Wendling via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 4 12:18:24 PDT 2025
================
@@ -7941,6 +7942,32 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, ParsedAttr &attr,
return true;
}
+ if (attr.getKind() == ParsedAttr::AT_CFISalt) {
+ if (attr.getNumArgs() == 0)
+ return true;
+
+ // Delay if this is not a function type.
+ StringRef Argument;
+ if (!S.checkStringLiteralArgumentAttr(attr, 0, Argument))
+ return false;
+
+ // Delay if this is not a function type.
+ if (!unwrapped.isFunctionType())
+ return false;
+
+ const auto *FnTy = unwrapped.get()->getAs<FunctionProtoType>();
+ if (!FnTy)
----------------
bwendling wrote:
The attribute is accessible only via the `FunctionProtoType`. To be more accurate, it really needs to be on `extern` function forward decls and the definition, because otherwise the attribute won't propagate correctly.
I'll add a test case to ensure this.
https://github.com/llvm/llvm-project/pull/141846
More information about the cfe-commits
mailing list