[clang] [clang] Add noipa attribute (PR #207502)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 10 05:11:50 PDT 2026


================
@@ -3105,6 +3105,12 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
   if (CodeGenOpts.DisableOutlining || D->hasAttr<NoOutlineAttr>())
     B.addAttribute(llvm::Attribute::NoOutline);
 
+  if (D->hasAttr<NoIPAAttr>()) {
+    B.addAttribute(llvm::Attribute::NoIPA);
+    if (!F->hasFnAttribute(llvm::Attribute::AlwaysInline))
----------------
AaronBallman wrote:

hmmm should we instead be adding the `NoInlineAttr` at the AST level? e.g., would someone using an AST matcher expect to see the noinline? I suspect so because the semantics are in effect, so things like clang-tidy checks that want to recommend inlining for whatever reason won't see that the function is marked as noinline in a roundabout way.

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


More information about the cfe-commits mailing list