================ @@ -3856,10 +3856,19 @@ CodeGenModule::isTriviallyRecursive(const FunctionDecl *FD) { bool CodeGenModule::shouldEmitFunction(GlobalDecl GD) { if (getFunctionLinkage(GD) != llvm::Function::AvailableExternallyLinkage) return true; + const auto *F = cast<FunctionDecl>(GD.getDecl()); if (CodeGenOpts.OptimizationLevel == 0 && !F->hasAttr<AlwaysInlineAttr>()) return false; + // We don't import function bodies from other named module units since that + // behavior may break ABI compatibility of the current unit. + Module *M = F->getOwningModule(); + if (M && M->isModulePurview() && + getContext().getCurrentNamedModule() != M->getTopLevelModule() && + !F->hasAttr<AlwaysInlineAttr>()) + return false; ---------------- tbaederr wrote:
```suggestion if (const Module *M = F->getOwningModule(); M && M->isModulePurview() && getContext().getCurrentNamedModule() != M->getTopLevelModule() && !F->hasAttr<AlwaysInlineAttr>()) return false; ``` Should work, right? https://github.com/llvm/llvm-project/pull/71031 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits