diff options
author | Erich Keane <erich.keane@intel.com> | 2018-02-08 23:14:15 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-02-08 23:14:15 +0000 |
commit | 3ec1743d0d774cea88d5e9e07b100250c0e7f85c (patch) | |
tree | 48312c89fdae16944846174020112964bb7915e9 /clang/lib/Basic/Targets.cpp | |
parent | b38799c105019617c4373fcc3da61a48e67bae45 (diff) | |
download | bcm5719-llvm-3ec1743d0d774cea88d5e9e07b100250c0e7f85c.tar.gz bcm5719-llvm-3ec1743d0d774cea88d5e9e07b100250c0e7f85c.zip |
Make march/target-cpu print a note with the list of valid values for ARM
When rejecting a march= or target-cpu command line parameter,
the message is quite lacking. This patch adds a note that prints
all possible values for the current target, if the target supports it.
This adds support for the ARM/AArch64 targets (more to come!).
Differential Revision: https://reviews.llvm.org/D42978
llvm-svn: 324673
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index a845a4c3fbe..e325403a1fa 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -38,6 +38,7 @@ #include "Targets/X86.h" #include "Targets/XCore.h" #include "clang/Basic/Diagnostic.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Triple.h" using namespace clang; @@ -607,6 +608,10 @@ TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags, // Set the target CPU if specified. if (!Opts->CPU.empty() && !Target->setCPU(Opts->CPU)) { Diags.Report(diag::err_target_unknown_cpu) << Opts->CPU; + SmallVector<StringRef, 32> ValidList; + Target->fillValidCPUList(ValidList); + if (!ValidList.empty()) + Diags.Report(diag::note_valid_options) << llvm::join(ValidList, ", "); return nullptr; } |