[all-commits] [llvm/llvm-project] f89327: [Driver] [Modules] Support -fmodule-output (1/2)

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Sun Jan 15 19:08:12 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f89327e28bc17a1d80fd5523520e62d8dd53c1cb
      https://github.com/llvm/llvm-project/commit/f89327e28bc17a1d80fd5523520e62d8dd53c1cb
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2023-01-16 (Mon, 16 Jan 2023)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/Driver.cpp
    M clang/test/Driver/lit.local.cfg
    A clang/test/Driver/module-output.cppm

  Log Message:
  -----------
  [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




More information about the All-commits mailing list