[clang] [C++20][Modules] Implement P1857R3 Modules Dependency Discovery (PR #107168)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 18 08:32:30 PST 2025
================
@@ -0,0 +1,58 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -std=c++20 %t/cwg2947_example1.cpp -D'DOT_BAR=.bar' -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 %t/cwg2947_example2.cpp -D'MOD_ATTR=[[vendor::shiny_module]]' -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 %t/cwg2947_example3.cpp -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 %t/cwg2947_example4.cpp -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 %t/cwg2947_example5.cpp -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 %t/cwg2947_example6.cpp -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 %t/cwg2947_ext1.cpp -verify -E | FileCheck %t/cwg2947_ext1.cpp
+// RUN: %clang_cc1 -std=c++20 %t/cwg2947_ext2.cpp -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 %t/cwg2947_ext3.cpp -fsyntax-only -verify
+
+//--- cwg2947_example1.cpp
+// #define DOT_BAR .bar
+export module foo DOT_BAR; // error: expansion of DOT_BAR; does not begin with ; or [
+// expected-error at -1 {{unexpected preprocessing token '.' after module name, only ';' and '[' (start of attribute specifier sequence) are allowed}}
+
+//--- cwg2947_example2.cpp
+export module M MOD_ATTR; // OK
+// expected-warning at -1 {{unknown attribute 'vendor::shiny_module' ignored}}
+
+//--- cwg2947_example3.cpp
+export module a
+ .b; // error: preprocessing token after pp-module-name is not ; or [
+// expected-error at -1 {{unexpected preprocessing token '.' after module name, only ';' and '[' (start of attribute specifier sequence) are allowed}}
+
+//--- cwg2947_example4.cpp
+export module M [[
+ attr1,
+ attr2 ]] ; // OK
+// expected-warning at -2 {{unknown attribute 'attr1' ignored}}
----------------
Endilll wrote:
Can you move this up right below `attr1`, so that `expected-warning at -1` works?
https://github.com/llvm/llvm-project/pull/107168
More information about the cfe-commits
mailing list