From 1ecbab56dcbb78268c8d19af34a50591f90b12a0 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Sun, 18 Feb 2024 15:08:02 +0800 Subject: [C++20] [Modules] Don't import non-inline function bodies even if it is marked as always_inline Close https://github.com/llvm/llvm-project/issues/80949 Previously, I thought the always-inline function can be an exception to enable optimizations as much as possible. However, it looks like it breaks the ABI requirement we discussed later. So it looks better to not import non-inline function bodies at all even if the function bodies are marked as always_inline. It doesn't produce regressions in some degree since the always_inline still works in the same TU. --- clang/lib/CodeGen/CodeGenModule.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index c984260b082c..836cd34a16c0 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3985,8 +3985,7 @@ bool CodeGenModule::shouldEmitFunction(GlobalDecl GD) { // behavior may break ABI compatibility of the current unit. if (const Module *M = F->getOwningModule(); M && M->getTopLevelModule()->isNamedModule() && - getContext().getCurrentNamedModule() != M->getTopLevelModule() && - !F->hasAttr()) + getContext().getCurrentNamedModule() != M->getTopLevelModule()) return false; if (F->hasAttr()) -- cgit v1.2.3