[clang] [clang] Function type attribute to prevent CFI instrumentation (PR #135836)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 15 11:48:13 PDT 2025


================
@@ -8627,6 +8636,40 @@ inline bool Type::isOverloadableType() const {
          !isMemberPointerType();
 }
 
+inline bool Type::hasCFIUncheckedCallee(const ASTContext &Context) const {
+  // Carefully strip sugar coating the underlying attributed type. We don't
+  // want to remove all the sugar because this will remove any wrapping
+  // attributed types.
+  QualType Ty(this, /*Quals=*/0);
+
+  while (1) {
+    if (Ty->hasAttr(attr::CFIUncheckedCallee))
+      return true;
+
+    QualType Desugared = Ty.getSingleStepDesugaredType(Context);
----------------
erichkeane wrote:

The fact that we're doing this I think means we're not properly adding this as a type, and I'm against it.  I believe we should be adding a new type to the AST to represent this.


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


More information about the cfe-commits mailing list