6 Commits

Author SHA1 Message Date
Jake Egan
a7b47fa17c [NFC] Disable test on AIX due to different default output
Previous attempt to stop this test from running on AIX didn't work,
so revert it and require not system-aix instead.

This reverts commit b1ac375e11c801be2a1e07e87be91ae54decf2eb.
2023-01-18 01:14:47 -05:00
Chuanqi Xu
fcb6afb508 [Driver] [C++20] [Modules] Don't emit unused-argument warning for '-fmodule-output' and '-fmodule-output='
Suppres the r unused-argument warning for -fmodule-output according to
the discussion thread in
https://gcc.gnu.org/pipermail/gcc/2022-December/240239.html.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D140001
2023-01-16 14:08:02 +08:00
Chuanqi Xu
3e9e8d6ef4 [Driver] [C++20] [Modules] Support -fmodule-output= (2/2)
The patch implements `-fmodule-output=`. This is helpful if the build
systems want to generate these output files in other places which is not
the same with -o specified or the input file lived.

Reviewed By: dblaikie, iains

Differential Revision: https://reviews.llvm.org/D137059
2023-01-16 14:01:05 +08:00
Chuanqi Xu
b1ac375e11 [NFC] Only run clang/test/Driver/module-output.cppm on x86 registered targets
On other targets (like ppc64-aix), the default output for `-c` may be `.s` instead of `.o`,
which makes the test failing. The patch require the test only run on
x86 registered targets to avoid the problem.
2023-01-16 13:49:37 +08:00
Chuanqi Xu
6f2e78195f [NFC] Require tests to skip on windows to avoid handling the different
slash in the filesystem

The modified test fails on windows for the diffeent slash direction ('/'
in linux and '/' on windows). The patch requires the test to skip on
windows to avoid such differences.
2023-01-16 11:48:08 +08:00
Chuanqi Xu
f89327e28b [Driver] [Modules] Support -fmodule-output (1/2)
Patches to support the one-phase compilation model for modules.

The behavior:
(1) If -o and -c is specified , the module file is in the same path
within the same directory as the output the -o specified and with a new
suffix .pcm.
(2) Otherwise, the module file is in the same path within the working
directory directory with the name of the input file with a new suffix
.pcm

For example,

```
Hello.cppm Use.cpp
```

A trivial one and the contents are ignored. When we run:

```
clang++ -std=c++20 -fmodule-output Hello.cppm -c
```

The directory would look like:

```
Hello.cppm  Hello.o  Hello.pcm Use.cpp
```

And if we run:

```
clang++ -std=c++20 -fmodule-output Hello.cppm -c -o output/Hello.o
```

Then the `output` directory may look like:

```
Hello.o  Hello.pcm
```

Reviewed By: dblaikie, iains, tahonermann

Differential Revision: https://reviews.llvm.org/D137058
2023-01-16 11:05:33 +08:00