aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2024-02-23 10:59:46 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2024-02-23 11:05:15 +0800
commit2e5af56b05c2d39ab2c829bf4c13190523b67ddd (patch)
tree59c9917f61b3c1ba0c1c771a4b193050b7c09861 /clang/lib/Frontend/FrontendAction.cpp
parent5ccf54640a2bdb6f36f65c574feb312da7f75243 (diff)
downloadllvm-2e5af56b05c2d39ab2c829bf4c13190523b67ddd.zip
llvm-2e5af56b05c2d39ab2c829bf4c13190523b67ddd.tar.gz
llvm-2e5af56b05c2d39ab2c829bf4c13190523b67ddd.tar.bz2
[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.
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index eff785b..b9fd9b8 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -689,7 +689,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromASTFile(
std::string(InputFile), CI.getPCHContainerReader(),
ASTUnit::LoadEverything, Diags, CI.getFileSystemOpts(),
- CI.getHeaderSearchOptsPtr());
+ CI.getHeaderSearchOptsPtr(), CI.getLangOptsPtr());
if (!AST)
return false;