summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2016-04-21 19:59:10 +0000
committerNico Weber <nicolasweber@gmx.de>2016-04-21 19:59:10 +0000
commitad2d8f3dfd188e0132718104dfc988c5dbc36a56 (patch)
tree995521797d8384ba8e0fad698cc6287cf8c42df2 /clang/lib/Driver/Driver.cpp
parentc22d29982b23e338c208adcb0ab464f004d7f00a (diff)
downloadbcm5719-llvm-ad2d8f3dfd188e0132718104dfc988c5dbc36a56.tar.gz
bcm5719-llvm-ad2d8f3dfd188e0132718104dfc988c5dbc36a56.zip
clang-cl: Don't assert on using /Yc with non-source files, PR27450
Move phase handling after input type validation. llvm-svn: 267040
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index c7a65fe5855..b855b9c5921 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1563,25 +1563,6 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
PL.clear();
types::getCompilationPhases(InputType, PL);
- if (YcArg) {
- // Add a separate precompile phase for the compile phase.
- if (FinalPhase >= phases::Compile) {
- llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> PCHPL;
- types::getCompilationPhases(types::TY_CXXHeader, PCHPL);
- Arg *PchInputArg = MakeInputArg(Args, Opts, YcArg->getValue());
-
- // Build the pipeline for the pch file.
- Action *ClangClPch = C.MakeAction<InputAction>(*PchInputArg, InputType);
- for (phases::ID Phase : PCHPL)
- ClangClPch = ConstructPhaseAction(C, Args, Phase, ClangClPch);
- assert(ClangClPch);
- Actions.push_back(ClangClPch);
- // The driver currently exits after the first failed command. This
- // relies on that behavior, to make sure if the pch generation fails,
- // the main compilation won't run.
- }
- }
-
// If the first step comes after the final phase we are doing as part of
// this compilation, warn the user about it.
phases::ID InitialPhase = PL[0];
@@ -1614,6 +1595,25 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
continue;
}
+ if (YcArg) {
+ // Add a separate precompile phase for the compile phase.
+ if (FinalPhase >= phases::Compile) {
+ llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> PCHPL;
+ types::getCompilationPhases(types::TY_CXXHeader, PCHPL);
+ Arg *PchInputArg = MakeInputArg(Args, Opts, YcArg->getValue());
+
+ // Build the pipeline for the pch file.
+ Action *ClangClPch = C.MakeAction<InputAction>(*PchInputArg, InputType);
+ for (phases::ID Phase : PCHPL)
+ ClangClPch = ConstructPhaseAction(C, Args, Phase, ClangClPch);
+ assert(ClangClPch);
+ Actions.push_back(ClangClPch);
+ // The driver currently exits after the first failed command. This
+ // relies on that behavior, to make sure if the pch generation fails,
+ // the main compilation won't run.
+ }
+ }
+
phases::ID CudaInjectionPhase =
(phases::Compile < FinalPhase &&
llvm::find(PL, phases::Compile) != PL.end())
OpenPOWER on IntegriCloud