20 Commits

Author SHA1 Message Date
Chuanqi Xu
255a163e51 [C++20] [Modules] Enable reduced BMI by default
As documented in 20.x, we'd like to keep reduced BMI off by default for
1~2 versions. And now we're in 22.x.

I rarely receive bug reports for reduced BMI. I am not sure about the
reason. Maybe not a lot of people are using it. Or it is really stable
enough.

And also, we've been enabling the reduced BMI internally for roughly half a
year.

So I think it's the time to move on. See the document changes for other
information.
2025-07-21 18:57:38 +08:00
yronglin
ea321392eb
[C++][Modules] A module directive may only appear as the first preprocessing tokens in a file (#144233)
This PR is 2nd part of
[P1857R3](https://github.com/llvm/llvm-project/pull/107168)
implementation, and mainly implement the restriction `A module directive
may only appear as the first preprocessing tokens in a file (excluding
the global module fragment.)`:
[cpp.pre](https://eel.is/c++draft/cpp.pre):
```
module-file:
    pp-global-module-fragment[opt] pp-module group[opt] pp-private-module-fragment[opt]
```

We also refine tests use `split-file` instead of conditional macro.

Signed-off-by: yronglin <yronglin777@gmail.com>
2025-06-21 18:58:56 +08:00
Argyrios Kyrtzidis
5e975d4f67 [clang/Driver] Also consider gnu++ standard when checking for modules support
Differential Revision: https://reviews.llvm.org/D150473
2023-05-18 12:34:07 -07:00
hezuoqiang
275ab246ee [Clang][test] Avoid FileCheck error when matching -cc1
FileCheck patterns consisting of only `-cc1` on a line by itself often
cause mismatches, e.g. with version strings formed from commit hashes
such as "clang-cc1514432c58". They should be changed to contain more
context and match more precisely.

Differential Revision: https://reviews.llvm.org/D141886
2023-01-20 23:36:09 -05:00
Chuanqi Xu
4a7be42d92 [C++20] [Modules] Remove unmaintained Header Module
Currently there is a -emit-header-module mode, which can combine several
headers together as a module interface. However, this breaks our
assumption (for standard c++ modules) about module interface. The module
interface should come from a module interface unit. And if it is a
header, it should be a header unit. And currently we have no ideas to
combine several headers together.

So I think this mode is an experimental one and it is not maintained and
it is not used. So it will be better to remove them.

Reviewed By: Bigcheese, dblaikie, bruno

Differential Revision: https://reviews.llvm.org/D137609
2022-11-18 10:39:33 +08:00
Fangrui Song
5c29ffda90 Revert "[Driver][test] Replace ^//$ with empty string"
This reverts commit 4817b7729a1846b709ec02b98bfe11b0125f8e8f.

It caused some `^/\n` and had some objection about its readability improvement.
2022-06-24 13:52:27 -07:00
Fangrui Song
4817b7729a [Driver][test] Replace ^//$ with empty string
The convention does not add //\n. Having all RUN/CHECK lines separated by //\n
makes editor movement difficult (e.g. { } in Vim).
2022-06-24 11:25:03 -07:00
Adrian Prantl
d951ca5439 Revert "[Driver] Enable to use C++20 standalne by -fcxx-modules"
This reverts commit a544710cd43ba9f7729a613c58729f146e792a8e.

See discussion in D120540.

This breaks C++ Clang modules on Darwin and also more than a dozen
tests in the LLDB testsuite.  I think we need to be more careful to
separate out the enabling of Clang C++ modules and C++20
modules. Either by having -fmodules-ts control the HaveModules flag,
or by adding a way to explicitly turn them off.
2022-06-01 12:11:57 -07:00
Adrian Prantl
c84b9bbac1 Revert "[NFC] Use %clang instead of %clang++ in tests"
This reverts commit 738c20e6df01217b6364c3b75d0ced6b6fb6277e as a dependency of D120540.
2022-06-01 12:11:56 -07:00
Adrian Prantl
128ffb332b Revert "[Driver][Modules] Remove dependence on linking support from clang/test/Driver/modules.cpp"
This reverts commit 35b1cfc76f08faabf3f27c0bd054acc7c854a6ca as a dependency of D120540.
2022-06-01 12:11:56 -07:00
Daniel McIntosh
35b1cfc76f [Driver][Modules] Remove dependence on linking support from clang/test/Driver/modules.cpp
The new tests in clang/test/Driver/modules.cpp added by D120540 will fail if the
toolchain getting tested doesn't support linking. This reduces the utility of
the test since we would like a failure of this test to reflect a problem with
modules. We should already have other tests that validate linking support.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D126669
2022-05-31 10:33:55 -04:00
Chuanqi Xu
738c20e6df [NFC] Use %clang instead of %clang++ in tests
Previously the tests uses %clang++ instead of %clang, which cause the
test fail in windows.
2022-05-30 14:38:46 +08:00
Chuanqi Xu
a544710cd4 [Driver] Enable to use C++20 standalne by -fcxx-modules
This patch allows user to use C++20 module by -fcxx-modules. Previously,
we could only use it under -std=c++20. Given that user could use C++20
coroutine standalonel by -fcoroutines-ts. It makes sense to offer an
option to use C++20 modules without enabling C++20.

Reviewed By: iains, MaskRay

Differential Revision: https://reviews.llvm.org/D120540
2022-05-30 14:19:56 +08:00
Chuanqi Xu
42c3c70a9e Revert "[Driver] Enable to use C++20 standalne by -fcxx-modules"
This reverts commit 99eca8353808f63670c647aeae03e0ce66eb21e0.

Since it would cause clang-tools-extra fail.
2022-05-30 10:43:13 +08:00
Chuanqi Xu
99eca83538 [Driver] Enable to use C++20 standalne by -fcxx-modules
This patch allows user to use C++20 module by -fcxx-modules. Previously,
we could only use it under -std=c++20. Given that user could use C++20
coroutine standalonel by -fcoroutines-ts. It makes sense to offer an
option to use C++20 modules without enabling C++20.

Reviewed By: iains, MaskRay

Differential Revision: https://reviews.llvm.org/D120540
2022-05-30 10:24:09 +08:00
Richard Smith
91604949ef Properly pass modules flags to frontend when using -std=c++20 instead of -std=c++2a.
In passing, also teach the driver to map /std:c++latest to -std=c++20
not -std=c++2a.
2020-08-24 17:49:58 -07:00
Tom Stellard
f18d747107 Fix Driver/modules.cpp test to work when build directory name contains '.s'
Reviewers: dyung, rsmith, hansw

Subscribers: mati865, mgorny, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66176

llvm-svn: 373275
2019-09-30 23:42:17 +00:00
Douglas Yung
1925f41872 Modify test to use -S instead of -c so that it works when an external assembler is used that is not present.
llvm-svn: 358537
2019-04-16 22:52:05 +00:00
Richard Smith
4ed54ee3db Tweak test to pass when using a non-integrated assembler.
llvm-svn: 358470
2019-04-16 01:44:53 +00:00
Richard Smith
b1b580e047 [c++20] Enable driver and frontend support for building and using
modules when -std=c++2a is specified.

llvm-svn: 358355
2019-04-14 11:11:37 +00:00