[clang] 7046a9f - [C++20] [Modules] Treat in class defined member functions in language linkage as implicitly inline
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 17 19:14:14 PDT 2024
Author: Chuanqi Xu
Date: 2024-09-18T10:13:06+08:00
New Revision: 7046a9fb05f65f4699a2e88abbcb7dad8a21db2d
URL: https://github.com/llvm/llvm-project/commit/7046a9fb05f65f4699a2e88abbcb7dad8a21db2d
DIFF: https://github.com/llvm/llvm-project/commit/7046a9fb05f65f4699a2e88abbcb7dad8a21db2d.diff
LOG: [C++20] [Modules] Treat in class defined member functions in language linkage as implicitly inline
Close https://github.com/llvm/llvm-project/issues/108732
This looks liek an oversight mostly.
Added:
clang/test/Modules/pr108732.cppm
Modified:
clang/lib/Sema/SemaDecl.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 8557c25b93a8da..31bf50a32a83c3 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9768,7 +9768,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
bool ImplicitInlineCXX20 = !getLangOpts().CPlusPlusModules ||
NewFD->isConstexpr() || NewFD->isConsteval() ||
!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
More information about the cfe-commits
mailing list