forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C++20] [Modules] Merge lambdas from Sema to imported one
Close llvm#102721 Previously we tried to merge lambdas between TUs. But we may still meet problems if we import and then include the headers containing the same lambda. The solution in this patch is, when we assigned a lambda numbering in a sema, try to see if there is already a same lambda imported. If yes, try to merge them.
- Loading branch information
1 parent
93f5c61
commit f7610cd
Showing
3 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// RUN: rm -rf %t | ||
// RUN: mkdir -p %t | ||
// RUN: split-file %s %t | ||
// | ||
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm | ||
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \ | ||
// RUN: -fprebuilt-module-path=%t | ||
// RUN: %clang_cc1 -std=c++20 %t/test.cc -fsyntax-only -verify \ | ||
// RUN: -fprebuilt-module-path=%t | ||
|
||
//--- foo.h | ||
inline auto x = []{}; | ||
|
||
//--- a.cppm | ||
module; | ||
#include "foo.h" | ||
export module a; | ||
export using ::x; | ||
|
||
//--- b.cppm | ||
module; | ||
import a; | ||
#include "foo.h" | ||
export module b; | ||
export using ::x; | ||
|
||
//--- test.cc | ||
// expected-no-diagnostics | ||
import a; | ||
import b; | ||
void test() { | ||
x(); | ||
} |