summaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorZiang Wan <ziangw2@illinois.edu>2019-06-25 23:57:14 +0000
committerZiang Wan <ziangw2@illinois.edu>2019-06-25 23:57:14 +0000
commit0adc2e56cb807367f40b6862d4e82e15f7ff12fa (patch)
tree2b14fbdc2f129fdf7249907952530519767ac1c8 /lib/Driver/Driver.cpp
parent7b34212e8613fbf7a7c06ddc6f46bb80a4ee7f2c (diff)
downloadclang-0adc2e56cb807367f40b6862d4e82e15f7ff12fa.tar.gz
print-supported-cpus quality of life patch.
Claim all input files so that clang does not give a warning. Add two short-cut aliases: -mcpu=? and -mtune=?. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 925ded71e1..57ead2d6eb 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -3377,15 +3377,21 @@ 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 the user specify --print-supported-cpus, or use -mcpu=?, or use
+ // -mtune=? (aliases), 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
+ Actions.clear();
Action *InputAc = C.MakeAction<InputAction>(*A, types::TY_C);
Actions.push_back(
C.MakeAction<PrecompileJobAction>(InputAc, types::TY_Nothing));
+ // claim all the input files to prevent argument unused warnings
+ for (auto &I : Inputs) {
+ const Arg *InputArg = I.second;
+ InputArg->claim();
+ }
}
// Claim ignored clang-cl options.