[all-commits] [llvm/llvm-project] 2e5af5: [C++20] [Modules] Allow to compile a pcm with and ...
Chuanqi Xu via All-commits
all-commits at lists.llvm.org
Thu Feb 22 19:07:03 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2e5af56b05c2d39ab2c829bf4c13190523b67ddd
https://github.com/llvm/llvm-project/commit/2e5af56b05c2d39ab2c829bf4c13190523b67ddd
Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
Date: 2024-02-23 (Fri, 23 Feb 2024)
Changed paths:
M clang/include/clang/Frontend/ASTUnit.h
M clang/include/clang/Frontend/CompilerInstance.h
M clang/include/clang/Frontend/CompilerInvocation.h
M clang/lib/Frontend/ASTUnit.cpp
M clang/lib/Frontend/FrontendAction.cpp
A clang/test/Modules/compile-pcm-with-pic.cppm
M clang/tools/c-index-test/core_main.cpp
M clang/tools/libclang/CIndex.cpp
Log Message:
-----------
[C++20] [Modules] Allow to compile a pcm with and without -fPIC
seperately
We can compile a module unit in 2 phase compilaton:
```
clang++ -std=c++20 a.cppm --precompile -o a.pcm
clang++ -std=c++20 a.pcm -c -o a.o
```
And it is a general requirement that we need to compile a translation
unit with and without -fPIC for static and shared libraries.
But for C++20 modules with 2 phase compilation, it may be waste of time
to compile them 2 times completely. It may be fine to generate one BMI
and compile it with and without -fPIC seperately.
e.g.,
```
clang++ -std=c++20 a.cppm --precompile -o a.pcm
clang++ -std=c++20 a.pcm -c -o a.o
clang++ -std=c++20 a.pcm -c -fPIC -o a-PIC.o
```
Then we can save the time to parse a.cppm repeatedly.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list