@@ -218,22 +218,31 @@ phases::ID Driver::getFinalPhase(const DerivedArgList &DAL,
218
218
219
219
// -{E,EP,P,M,MM} only run the preprocessor.
220
220
if (CCCIsCPP () || (PhaseArg = DAL.getLastArg (options::OPT_E)) ||
221
+ (PhaseArg = DAL.getLastArg (options::OPT_fsyntax_only)) ||
221
222
(PhaseArg = DAL.getLastArg (options::OPT__SLASH_EP)) ||
222
223
(PhaseArg = DAL.getLastArg (options::OPT_M, options::OPT_MM)) ||
223
224
(PhaseArg = DAL.getLastArg (options::OPT__SLASH_P))) {
224
- FinalPhase = phases::Preprocess;
225
225
226
- // -fsyntax-only stops Fortran compilation after FortranFrontend
227
- } else if (IsFortranMode () && (PhaseArg = DAL.getLastArg (options::OPT_fsyntax_only))) {
228
- FinalPhase = phases::FortranFrontend;
226
+ // -fsyntax-only or -E stops Fortran compilation after FortranFrontend
227
+ if (IsFortranMode () && (DAL.getLastArg (options::OPT_E) ||
228
+ DAL.getLastArg (options::OPT_fsyntax_only))) {
229
+ FinalPhase = phases::FortranFrontend;
230
+
231
+ // if not Fortran, fsyntax_only implies 'Compile' is the FinalPhase
232
+ } else if (DAL.getLastArg (options::OPT_fsyntax_only)) {
233
+ FinalPhase = phases::Compile;
234
+
235
+ // everything else has 'Preprocess' as its FinalPhase
236
+ } else {
237
+ FinalPhase = phases::Preprocess;
238
+ }
229
239
230
240
// --precompile only runs up to precompilation.
231
241
} else if ((PhaseArg = DAL.getLastArg (options::OPT__precompile))) {
232
242
FinalPhase = phases::Precompile;
233
243
234
- // -{fsyntax-only,-analyze,emit-ast} only run up to the compiler.
235
- } else if ((PhaseArg = DAL.getLastArg (options::OPT_fsyntax_only)) ||
236
- (PhaseArg = DAL.getLastArg (options::OPT_module_file_info)) ||
244
+ // -{analyze,emit-ast} only run up to the compiler.
245
+ } else if ((PhaseArg = DAL.getLastArg (options::OPT_module_file_info)) ||
237
246
(PhaseArg = DAL.getLastArg (options::OPT_verify_pch)) ||
238
247
(PhaseArg = DAL.getLastArg (options::OPT_rewrite_objc)) ||
239
248
(PhaseArg = DAL.getLastArg (options::OPT_rewrite_legacy_objc)) ||
0 commit comments