diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 14 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 1 |
2 files changed, 14 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); diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 5596e4b6a3c..7ba08c6acad 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1752,6 +1752,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Opts.ShowHelp = Args.hasArg(OPT_help); Opts.ShowStats = Args.hasArg(OPT_print_stats); Opts.ShowTimers = Args.hasArg(OPT_ftime_report); + Opts.PrintSupportedCPUs = Args.hasArg(OPT__print_supported_cpus); Opts.TimeTrace = Args.hasArg(OPT_ftime_trace); Opts.ShowVersion = Args.hasArg(OPT_version); Opts.ASTMergeFiles = Args.getAllArgValues(OPT_ast_merge); |