aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorMaggieYingYi <29144504+MaggieYingYi@users.noreply.github.com>2025-06-10 12:52:44 +0100
committerGitHub <noreply@github.com>2025-06-10 12:52:44 +0100
commit4fb81f11cea0fce9f1f5409fcd55ae3aba70d368 (patch)
tree35e273e058cb01be9246ecb554f7d96eb58a0abe /clang/lib/Driver/Driver.cpp
parent5955f3e848bc7da4f2e9748249891f6e926b6375 (diff)
downloadllvm-4fb81f11cea0fce9f1f5409fcd55ae3aba70d368.zip
llvm-4fb81f11cea0fce9f1f5409fcd55ae3aba70d368.tar.gz
llvm-4fb81f11cea0fce9f1f5409fcd55ae3aba70d368.tar.bz2
[Frontend][PCH]-Add support for ignoring PCH options (-ignore-pch). (#142409)
Visual Studio has an argument to ignore all PCH related switches. clang-cl has also support option /Y-. Having the same option in clang would be helpful. This commit is to add support for ignoring PCH options (-ignore-pch). The commit includes: 1. Implement -ignore-pch as a Driver option. 2. Add a Driver test and a PCH test. 3. Add a section of -ignore-pch to user manual. 4. Add a release note for the new option '-ignore-pch'. Code reviewed by: Matheus Izvekov <mizvekov@gmail.com>
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 80728da..a03fd50 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -4331,6 +4331,15 @@ void Driver::handleArguments(Compilation &C, DerivedArgList &Args,
YcArg = YuArg = nullptr;
}
+ if (Args.hasArg(options::OPT_include_pch) &&
+ (FinalPhase == phases::Preprocess ||
+ Args.hasArg(options::OPT_ignore_pch))) {
+ // If only preprocessing or -ignore-pch is used, -include-pch is disabled.
+ // Since -emit-pch is CC1option, it will not be added to command argments if
+ // -ignore-pch is used.
+ Args.eraseArg(options::OPT_include_pch);
+ }
+
bool LinkOnly = phases::Link == FinalPhase && Inputs.size() > 0;
for (auto &I : Inputs) {
types::ID InputType = I.first;