diff options
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 17552b28763..3bda71597e3 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1671,7 +1671,8 @@ bool Driver::HandleImmediateArgs(const Compilation &C) { } if (C.getArgs().hasArg(options::OPT_v) || - C.getArgs().hasArg(options::OPT__HASH_HASH_HASH)) { + C.getArgs().hasArg(options::OPT__HASH_HASH_HASH) || + C.getArgs().hasArg(options::OPT__print_supported_cpus)) { PrintVersion(C, llvm::errs()); SuppressMissingInputWarning = true; } @@ -3375,6 +3376,17 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args, Args.ClaimAllArgs(options::OPT_cl_compile_Group); } + // If the use specify --print-supported-cpus, clang will only print out + // supported cpu names without doing compilation. + if (Arg *A = Args.getLastArg(options::OPT__print_supported_cpus)) { + Actions.clear(); + // the compilation now has only two phases: Input and Compile + // use the --prints-supported-cpus flag as the dummy input to cc1 + Action *InputAc = C.MakeAction<InputAction>(*A, types::TY_C); + Actions.push_back( + C.MakeAction<PrecompileJobAction>(InputAc, types::TY_Nothing)); + } + // Claim ignored clang-cl options. Args.ClaimAllArgs(options::OPT_cl_ignored_Group); |