[llvm-branch-commits] [clang] release/19.x: [C++20] [Modules] Treat in class defined member functions in language linkage as implicitly inline (PR #109077)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 17 19:44:04 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (llvmbot)

<details>
<summary>Changes</summary>

Backport 7046a9fb05f65f4699a2e88abbcb7dad8a21db2d

Requested by: @<!-- -->ChuanqiXu9

---
Full diff: https://github.com/llvm/llvm-project/pull/109077.diff


2 Files Affected:

- (modified) clang/lib/Sema/SemaDecl.cpp (+1-1) 
- (added) clang/test/Modules/pr108732.cppm (+14) 


``````````diff
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index d608dd92a4b479..a0a4d4fd1d3a27 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9733,7 +9733,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
     // FIXME: We need a better way to separate C++ standard and clang modules.
     bool ImplicitInlineCXX20 = !getLangOpts().CPlusPlusModules ||
                                !NewFD->getOwningModule() ||
-                               NewFD->isFromExplicitGlobalModule() ||
+                               NewFD->isFromGlobalModule() ||
                                NewFD->getOwningModule()->isHeaderLikeModule();
     bool isInline = D.getDeclSpec().isInlineSpecified();
     bool isVirtual = D.getDeclSpec().isVirtualSpecified();
diff --git a/clang/test/Modules/pr108732.cppm b/clang/test/Modules/pr108732.cppm
new file mode 100644
index 00000000000000..f3b495aa826ce3
--- /dev/null
+++ b/clang/test/Modules/pr108732.cppm
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -std=c++20 %s -ast-dump | FileCheck %s
+export module mod;
+
+extern "C++" {
+class C
+{
+public:
+bool foo() const {
+    return true;
+}
+};
+}
+
+// CHECK: foo {{.*}}implicit-inline

``````````

</details>


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


More information about the llvm-branch-commits mailing list