[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:43:33 PDT 2024
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/109077
Backport 7046a9fb05f65f4699a2e88abbcb7dad8a21db2d
Requested by: @ChuanqiXu9
>From 304d73da27aae8c88080764225d10b61b65b5f5f Mon Sep 17 00:00:00 2001
From: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
Date: Wed, 18 Sep 2024 10:07:57 +0800
Subject: [PATCH] [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.
(cherry picked from commit 7046a9fb05f65f4699a2e88abbcb7dad8a21db2d)
---
clang/lib/Sema/SemaDecl.cpp | 2 +-
clang/test/Modules/pr108732.cppm | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 clang/test/Modules/pr108732.cppm
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
More information about the llvm-branch-commits
mailing list