Changeset View
Changeset View
Standalone View
Standalone View
lib/Driver/Driver.cpp
Show First 20 Lines • Show All 274 Lines • ▼ Show 20 Lines | if (CCCIsCPP() || (PhaseArg = DAL.getLastArg(options::OPT_E)) || | ||||
FinalPhase = phases::Preprocess; | FinalPhase = phases::Preprocess; | ||||
// --precompile only runs up to precompilation. | // --precompile only runs up to precompilation. | ||||
} else if ((PhaseArg = DAL.getLastArg(options::OPT__precompile))) { | } else if ((PhaseArg = DAL.getLastArg(options::OPT__precompile))) { | ||||
FinalPhase = phases::Precompile; | FinalPhase = phases::Precompile; | ||||
// -{fsyntax-only,-analyze,emit-ast} only run up to the compiler. | // -{fsyntax-only,-analyze,emit-ast} only run up to the compiler. | ||||
} else if ((PhaseArg = DAL.getLastArg(options::OPT_fsyntax_only)) || | } else if ((PhaseArg = DAL.getLastArg(options::OPT_fsyntax_only)) || | ||||
(PhaseArg = DAL.getLastArg(options::OPT_print_supported_cpus)) || | |||||
(PhaseArg = DAL.getLastArg(options::OPT_module_file_info)) || | (PhaseArg = DAL.getLastArg(options::OPT_module_file_info)) || | ||||
(PhaseArg = DAL.getLastArg(options::OPT_verify_pch)) || | (PhaseArg = DAL.getLastArg(options::OPT_verify_pch)) || | ||||
(PhaseArg = DAL.getLastArg(options::OPT_rewrite_objc)) || | (PhaseArg = DAL.getLastArg(options::OPT_rewrite_objc)) || | ||||
(PhaseArg = DAL.getLastArg(options::OPT_rewrite_legacy_objc)) || | (PhaseArg = DAL.getLastArg(options::OPT_rewrite_legacy_objc)) || | ||||
(PhaseArg = DAL.getLastArg(options::OPT__migrate)) || | (PhaseArg = DAL.getLastArg(options::OPT__migrate)) || | ||||
(PhaseArg = DAL.getLastArg(options::OPT_emit_iterface_stubs)) || | (PhaseArg = DAL.getLastArg(options::OPT_emit_iterface_stubs)) || | ||||
(PhaseArg = DAL.getLastArg(options::OPT__analyze, | (PhaseArg = DAL.getLastArg(options::OPT__analyze, | ||||
options::OPT__analyze_auto)) || | options::OPT__analyze_auto)) || | ||||
▲ Show 20 Lines • Show All 1,377 Lines • ▼ Show 20 Lines | bool Driver::HandleImmediateArgs(const Compilation &C) { | ||||
if (C.getArgs().hasArg(options::OPT__version)) { | if (C.getArgs().hasArg(options::OPT__version)) { | ||||
// Follow gcc behavior and use stdout for --version and stderr for -v. | // Follow gcc behavior and use stdout for --version and stderr for -v. | ||||
PrintVersion(C, llvm::outs()); | PrintVersion(C, llvm::outs()); | ||||
return false; | return false; | ||||
} | } | ||||
if (C.getArgs().hasArg(options::OPT_v) || | 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)) { | C.getArgs().hasArg(options::OPT_print_supported_cpus)) { | ||||
PrintVersion(C, llvm::errs()); | PrintVersion(C, llvm::errs()); | ||||
SuppressMissingInputWarning = true; | SuppressMissingInputWarning = true; | ||||
} | } | ||||
if (C.getArgs().hasArg(options::OPT_v)) { | if (C.getArgs().hasArg(options::OPT_v)) { | ||||
if (!SystemConfigDir.empty()) | if (!SystemConfigDir.empty()) | ||||
llvm::errs() << "System configuration file directory: " | llvm::errs() << "System configuration file directory: " | ||||
<< SystemConfigDir << "\n"; | << SystemConfigDir << "\n"; | ||||
▲ Show 20 Lines • Show All 1,687 Lines • ▼ Show 20 Lines | void Driver::BuildActions(Compilation &C, DerivedArgList &Args, | ||||
// If we are linking, claim any options which are obviously only used for | // If we are linking, claim any options which are obviously only used for | ||||
// compilation. | // compilation. | ||||
if (FinalPhase == phases::Link && PL.size() == 1) { | if (FinalPhase == phases::Link && PL.size() == 1) { | ||||
Args.ClaimAllArgs(options::OPT_CompileOnly_Group); | Args.ClaimAllArgs(options::OPT_CompileOnly_Group); | ||||
Args.ClaimAllArgs(options::OPT_cl_compile_Group); | Args.ClaimAllArgs(options::OPT_cl_compile_Group); | ||||
} | } | ||||
// if the user specify --print-supported-cpus, or use -mcpu=?, or use | // If --print-supported-cpus, -mcpu=? or -mtune=? is specified, build a custom | ||||
// -mtune=? (aliases), clang will only print out supported cpu names | // Compile phase that prints out supported cpu models and quits. | ||||
// without doing compilation. | if (Arg *A = Args.getLastArg(options::OPT_print_supported_cpus)) { | ||||
if (Arg *A = Args.getLastArg(options::OPT__print_supported_cpus)) { | // Use the -mcpu=? flag as the dummy input to cc1. | ||||
// the compilation now has only two phases: Input and Compile | |||||
// use the --prints-supported-cpus flag as the dummy input to cc1 | |||||
Actions.clear(); | Actions.clear(); | ||||
Action *InputAc = C.MakeAction<InputAction>(*A, types::TY_C); | Action *InputAc = C.MakeAction<InputAction>(*A, types::TY_C); | ||||
Actions.push_back( | Actions.push_back( | ||||
C.MakeAction<PrecompileJobAction>(InputAc, types::TY_Nothing)); | C.MakeAction<PrecompileJobAction>(InputAc, types::TY_Nothing)); | ||||
// claim all the input files to prevent argument unused warnings | for (auto &I : Inputs) | ||||
for (auto &I : Inputs) { | I.second->claim(); | ||||
const Arg *InputArg = I.second; | |||||
InputArg->claim(); | |||||
} | |||||
} | } | ||||
// Claim ignored clang-cl options. | // Claim ignored clang-cl options. | ||||
Args.ClaimAllArgs(options::OPT_cl_ignored_Group); | Args.ClaimAllArgs(options::OPT_cl_ignored_Group); | ||||
// Claim --cuda-host-only and --cuda-compile-host-device, which may be passed | // Claim --cuda-host-only and --cuda-compile-host-device, which may be passed | ||||
// to non-CUDA compilations and should not trigger warnings there. | // to non-CUDA compilations and should not trigger warnings there. | ||||
Args.ClaimAllArgs(options::OPT_cuda_host_only); | Args.ClaimAllArgs(options::OPT_cuda_host_only); | ||||
▲ Show 20 Lines • Show All 1,438 Lines • Show Last 20 Lines |