[clang] Support C++20 Modules in clang-repl (PR #79261)

Nathan Chancellor via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 07:21:21 PST 2024


nathanchance wrote:

> But due to I can't reproduce the failure, @nathanchance would you like to make this? I don't want to make something that I can't test.

I don't mind submitting something if I have some guidance around how this should be handled (I am a little lost in this thread at the moment). Alternatively, I am able to reproduce this with:

(`/usr/bin/clang -print-target-triple` is `x86_64-pc-linux-gnu`, if you'd rather use it directly)

```sh
$ cmake \
-B build \
-G Ninja \
-S llvm \
-Wno-dev \
--log-level=NOTICE \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_DEFAULT_TARGET_TRIPLE=$(/usr/bin/clang -print-target-triple) \
-DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_USE_LINKER=lld

$ ninja -C build check-clang
...
error: PCH file was compiled for the target 'x86_64-pc-linux-gnu' but the current translation unit is being compiled for target 'x86_64-unknown-linux-gnu'
error: module file .../tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.pcm cannot be loaded due to a configuration mismatch with the current compilation [-Wmodule-file-config-mismatch]
error: Parsing failed.
...
```

so it should be easy to test and verify the fix.

https://github.com/llvm/llvm-project/pull/79261


More information about the cfe-commits mailing list