https://github.com/yronglin deleted
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1329,6 +1341,100 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
@@ -1329,6 +1341,100 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
https://github.com/cor3ntin edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1329,6 +1341,100 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 01/11] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20?=
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 01/11] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20?=
@@ -520,6 +524,18 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
RecomputeNeedsHandleIdentifier();
}
+ /// Determine whether this is the contextual keyword \c module.
+ bool isModulesDecl() const { return IsModulesDecl; }
+
+ /// Set whether this
@@ -932,6 +932,12 @@ def warn_module_conflict : Warning<
InGroup;
// C++20 modules
+def err_module_decl_cannot_be_macros : Error<
+ "the module name in a module%select{| partition}0 declaration cannot contain
"
+ "an object-like macro %1, it's consists of one or more
@@ -1329,6 +1341,100 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
@@ -1329,6 +1341,100 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
@@ -520,6 +524,18 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
RecomputeNeedsHandleIdentifier();
}
+ /// Determine whether this is the contextual keyword \c module.
+ bool isModulesDecl() const { return IsModulesDecl; }
yronglin wrote:
@@ -932,6 +932,12 @@ def warn_module_conflict : Warning<
InGroup;
// C++20 modules
+def err_module_decl_cannot_be_macros : Error<
+ "the module name in a module%select{| partition}0 declaration cannot contain
"
+ "an object-like macro %1, it's consists of one or more
@@ -520,6 +524,18 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
RecomputeNeedsHandleIdentifier();
}
+ /// Determine whether this is the contextual keyword \c module.
+ bool isModulesDecl() const { return IsModulesDecl; }
cor3ntin wrote:
@@ -1329,6 +1341,100 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
@@ -520,6 +524,18 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
RecomputeNeedsHandleIdentifier();
}
+ /// Determine whether this is the contextual keyword \c module.
+ bool isModulesDecl() const { return IsModulesDecl; }
+
+ /// Set whether this
https://github.com/cor3ntin edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1329,6 +1341,100 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
https://github.com/cor3ntin commented:
I'm starting to find the state machine
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
yronglin wrote:
Should we continue build a module declaration even if error occurred when
parsing module names?
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
yronglin wrote:
Thanks for your review @Bigcheese !
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -932,6 +932,12 @@ def warn_module_conflict : Warning<
InGroup;
// C++20 modules
+def err_module_decl_cannot_be_macros : Error<
+ "the name of a module%select{| partition}0 declaration cannot contains "
+ "an object-like macro %1, and the macro will not expand"
+
@@ -1329,6 +1341,129 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
https://github.com/yronglin edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,87 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -std=c++20 %t/A.cppm -triple x86_64-linux-gnu -verify
+// RUN: %clang_cc1 -std=c++20 %t/B.cppm -triple x86_64-linux-gnu -verify
+// RUN: %clang_cc1 -std=c++20 %t/C.cppm
@@ -1329,6 +1341,129 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
@@ -1329,6 +1341,129 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 01/10] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20?=
https://github.com/Bigcheese edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -932,6 +932,12 @@ def warn_module_conflict : Warning<
InGroup;
// C++20 modules
+def err_module_decl_cannot_be_macros : Error<
+ "the name of a module%select{| partition}0 declaration cannot contains "
+ "an object-like macro %1, and the macro will not expand"
+
@@ -1329,6 +1341,129 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
@@ -932,6 +932,12 @@ def warn_module_conflict : Warning<
InGroup;
// C++20 modules
+def err_module_decl_cannot_be_macros : Error<
+ "the name of a module%select{| partition}0 declaration cannot contains "
+ "an object-like macro %1, and the macro will not expand"
+
@@ -1329,6 +1341,129 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
@@ -1329,6 +1341,129 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
@@ -0,0 +1,87 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -std=c++20 %t/A.cppm -triple x86_64-linux-gnu -verify
+// RUN: %clang_cc1 -std=c++20 %t/B.cppm -triple x86_64-linux-gnu -verify
+// RUN: %clang_cc1 -std=c++20 %t/C.cppm
@@ -1329,6 +1341,129 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
Bigcheese wrote:
> The paper does not clearly says whether disallow function-like macro is also
> needed, but I think disallow function-like macro has the same goal as the
> paper. WDYT? @cor3ntin @ChuanqiXu9
>
> The wording in the paper said: _No identifier in the pp-module-name or
>
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 1/9] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20De?=
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 1/8] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20De?=
@@ -0,0 +1,80 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -std=c++20 %t/A.cppm -triple x86_64-linux-gnu -verify
+// RUN: %clang_cc1 -std=c++20 %t/B.cppm -triple x86_64-linux-gnu -verify
+// RUN: %clang_cc1 -std=c++20 %t/C.cppm
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 1/7] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20De?=
@@ -1329,6 +1342,129 @@ bool Preprocessor::LexAfterModuleImport(Token ) {
return true;
}
+/// Lex a token following the 'module' contextual keyword.
+///
+/// [cpp.module]/p2:
+/// The pp-tokens, if any, of a pp-module shall be of the form:
+/// pp-module-name
yronglin wrote:
> Either way, the parsing of semi conlon/attributes should stay in the parser.
Agree! It's still stay in the parser.
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 1/6] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20De?=
cor3ntin wrote:
> Thanks! I'd like to move the implementation from Parser to Preprocessor. I
> think It would make more sense to do these checks during lexing.
I'm not sure that would make a lot of sense (unless we were doing exactly how
the specification does it, by injecting a token for a
yronglin wrote:
Thanks! I'd like to move the implementation from Parser to Preprocessor. I
think It would make more sense to do these checks during lexing.
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cor3ntin wrote:
> > I think the approach looks good.
> > Do we have existing tests for the use of `module` as an identifier outside
> > of a module declaration?
>
> IIUC, do you mean something looks like the following? I didn't find it in the
> test case:
>
> ```
> void foo() {
> int
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=1 -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=2 -verify
+
+module;
+export module x;
+#include "version.h"
+#if TEST ==
yronglin wrote:
> My reading is that
>
> ```c++
> #define SOME_MACRO
> module foo SOME_MACRO;
> ```
>
> SOME_MACRO is expanded
If this is the case, the current processing in the
`Preprocessor::LexAfterModuleDecl` function is incorrect. The implementation in
this PR treats the tokens
yronglin wrote:
> I think the approach looks good.
>
> Do we have existing tests for the use of `module` as an identifier outside of
> a module declaration?
IIUC, do you mean something looks like the following? I didn't find it in the
test case:
```
void foo() {
int module = 0;
}
```
@@ -0,0 +1,52 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/A.cppm -triple
x86_64-linux-gnu -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/B.cppm -triple
x86_64-linux-gnu -verify
@@ -0,0 +1,52 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/A.cppm -triple
x86_64-linux-gnu -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/B.cppm -triple
x86_64-linux-gnu -verify
https://github.com/cor3ntin edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/cor3ntin commented:
I think the approach looks good.
Do we have existing tests for the use of `module` as an identifier outside of a
module declaration?
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cor3ntin wrote:
> Dose this [note](https://eel.is/c++draft/cpp.module#note-1) have a conflict
> with P3034R1?
>
> ```
> [Note 1: Each identifier currently defined as a macro name is replaced by its
> replacement list of preprocessing tokens. — end note]
> ```
My reading is that
```cpp
yronglin wrote:
Dose this [note](https://eel.is/c++draft/cpp.module#note-1) have a conflict
with P3034R1?
```
[Note 1: Each identifier currently defined as a macro name is replaced by its
replacement list of preprocessing tokens. — end note]
```
https://github.com/llvm/llvm-project/pull/90574
https://github.com/yronglin edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2686,18 +2693,31 @@ bool Parser::ParseModuleName(
}
Diag(Tok, diag::err_module_expected_ident) << IsImport;
- SkipUntil(tok::semi);
+ SkipUntil(tok::semi, StopBeforeMatch);
return true;
}
-// Record this part of the module path.
-
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 1/4] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20De?=
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 1/4] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20De?=
@@ -2686,18 +2693,31 @@ bool Parser::ParseModuleName(
}
Diag(Tok, diag::err_module_expected_ident) << IsImport;
- SkipUntil(tok::semi);
+ SkipUntil(tok::semi, StopBeforeMatch);
return true;
}
-// Record this part of the module path.
-
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff 10aab63c9cb49d3ddfbe2cf8992de433efeef6f1
0b472f255ca8f9279e58f25e2350cd0eb31baad7 --
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 1/3] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20De?=
https://github.com/yronglin updated
https://github.com/llvm/llvm-project/pull/90574
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024 17:18:26 +0800
Subject: [PATCH 1/2] =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20De?=
yronglin wrote:
> > This means that no macros of any kind can appear in the module name.
>
> Exactly. This is why the grammar in the wording is defined in terms of
> `pp-token` and not `identifiers`: no macro expansion takes place at all.
Thanks! Let's use `LexUnexpandedToken` during parsing
cor3ntin wrote:
> This means that no macros of any kind can appear in the module name.
Exactly. This is why the grammar in the wording is defined in terms of
`pp-token` and not `identifiers`: no macro expansion takes place at all.
https://github.com/llvm/llvm-project/pull/90574
yronglin wrote:
> module foo(); should be Ill-formed.
Ahh, so case like the following also should be ill-formed:
```
#define FUNC_LIKE(X) function_like_##X
export module FUNC_LIKE(bar);
```
> we can get the module name of a TU by cat and grep
This means that no macros of any kind can appear in
ChuanqiXu9 wrote:
> The paper does not clearly says whether disallow function-like macro is also
> needed, but I think disallow function-like macro has the same goal as the
> paper. WDYT? @cor3ntin @ChuanqiXu9
>
> The wording in the paper said: _No identifier in the pp-module-name or
>
cor3ntin wrote:
A function like macro needs parentheses to be substituted. As such,
#define foo()
module foo;
Should be allowed (and foo is not a macro expansion on line 2)
module foo(); should be Ill-formed.
https://github.com/llvm/llvm-project/pull/90574
yronglin wrote:
The paper does not clearly state whether disallow function-like macro is also
needed, but I think disallow function-like macro has the same goal as the
paper. WDYT? @cor3ntin @ChuanqiXu9
https://github.com/llvm/llvm-project/pull/90574
https://github.com/yronglin edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/yronglin edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=1 -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=2 -verify
+
+module;
+export module x;
+#include "version.h"
+#if TEST ==
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=1 -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=2 -verify
+
+module;
+export module x;
+#include "version.h"
+#if TEST ==
https://github.com/yronglin edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1671,6 +1671,8 @@ def err_unexpected_module_decl : Error<
"module declaration can only appear at the top level">;
def err_module_expected_ident : Error<
"expected a module name after '%select{module|import}0'">;
+def err_module_decl_cannot_be_macros : Error<
+ "module
https://github.com/yronglin edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/yronglin edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2690,6 +2690,13 @@ bool Parser::ParseModuleName(
return true;
}
+// P3034R1: Module Declarations Shouldn’t be Macros
+if (!IsImport && Tok.getLocation().isMacroID()) {
+ Diag(Tok, diag::err_module_decl_cannot_be_macros);
+ SkipUntil(tok::semi);
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=1 -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=2 -verify
+
+module;
+export module x;
+#include "version.h"
+#if TEST ==
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=1 -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=2 -verify
+
+module;
+export module x;
+#include "version.h"
+#if TEST ==
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=1 -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=2 -verify
+
+module;
+export module x;
+#include "version.h"
+#if TEST ==
https://github.com/ChuanqiXu9 commented:
LGTM otherwise. I'd like to leave this to @cor3ntin
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/ChuanqiXu9 edited
https://github.com/llvm/llvm-project/pull/90574
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=1 -verify
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -triple
x86_64-linux-gnu -DTEST=2 -verify
+
+module;
+export module x;
+#include "version.h"
+#if TEST ==
@@ -1671,6 +1671,8 @@ def err_unexpected_module_decl : Error<
"module declaration can only appear at the top level">;
def err_module_expected_ident : Error<
"expected a module name after '%select{module|import}0'">;
+def err_module_decl_cannot_be_macros : Error<
+ "module
@@ -2690,6 +2690,13 @@ bool Parser::ParseModuleName(
return true;
}
+// P3034R1: Module Declarations Shouldn’t be Macros
+if (!IsImport && Tok.getLocation().isMacroID()) {
+ Diag(Tok, diag::err_module_decl_cannot_be_macros);
+ SkipUntil(tok::semi);
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: None (yronglin)
Changes
This PR implement [P3034R1 Module Declarations Shouldn’t be
Macros](https://wg21.link/P3034R1)
---
Full diff: https://github.com/llvm/llvm-project/pull/90574.diff
9 Files Affected:
- (modified)
https://github.com/yronglin created
https://github.com/llvm/llvm-project/pull/90574
This PR implement [P3034R1 Module Declarations Shouldn’t be
Macros](https://wg21.link/P3034R1)
>From 1dcb4c3ac1efaf3a6a4317751e23089a6c8ccac1 Mon Sep 17 00:00:00 2001
From: yronglin
Date: Tue, 30 Apr 2024
89 matches
Mail list logo