[clang] [Clang][Modules] Emit GMF GNU-inline bodies for inlining (PR #228962)

Mathew Joseph via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 14 20:12:27 PDT 2026


================
@@ -5092,7 +5092,10 @@ bool CodeGenModule::shouldEmitFunction(GlobalDecl GD) {
     //
     // TODO: Maybe it is better to give it a warning if we call a non-inline
     // function from other module units which is marked as always-inline.
-    if (!F->isTemplateInstantiation() || !F->hasAttr<AlwaysInlineAttr>()) {
+    // GNU-inline definitions in the global module fragment are also needed
+    // for inlining, but definitions owned by named modules remain restricted.
+    if ((!F->isTemplateInstantiation() || !F->hasAttr<AlwaysInlineAttr>()) &&
----------------
mathew1046 wrote:

I thought `&&` was needed since we return `false` only when neither exception applies. Wouldn’t `||` reject each case unless both exceptions apply? Is my understanding correct?

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


More information about the cfe-commits mailing list