diff options
author | Gabor Ballabas <gaborb@inf.u-szeged.hu> | 2015-06-04 17:56:32 +0000 |
---|---|---|
committer | Gabor Ballabas <gaborb@inf.u-szeged.hu> | 2015-06-04 17:56:32 +0000 |
commit | 208826cc0f1621d4fba82ae267b9b0385d4dcf17 (patch) | |
tree | 4008c35101fa39878adb7943a4b07a4ce32d7137 /clang/lib/Driver/Tools.cpp | |
parent | e194400233d23819062ee1a2cf4b51a31a165770 (diff) | |
download | bcm5719-llvm-208826cc0f1621d4fba82ae267b9b0385d4dcf17.tar.gz bcm5719-llvm-208826cc0f1621d4fba82ae267b9b0385d4dcf17.zip |
Allow case-insensitive values for -mcpu for ARM
GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mcpu option.
llvm-svn: 239059
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 3218d117b58..43536cbb8dc 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -767,7 +767,7 @@ static void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple, // the only function we have to check if a cpu is valid is // getLLVMArchSuffixForARM which also needs an architecture. if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) { - StringRef CPU = arm::getARMTargetCPU(Args, Triple); + std::string CPU = arm::getARMTargetCPU(Args, Triple); StringRef Arch = arm::getARMArch(Args, Triple); if (strcmp(arm::getLLVMArchSuffixForARM(CPU, Arch), "") == 0) D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); @@ -5748,12 +5748,12 @@ const char *arm::getARMCPUForMArch(const ArgList &Args, } /// getARMTargetCPU - Get the (LLVM) name of the ARM cpu we are targeting. -StringRef arm::getARMTargetCPU(const ArgList &Args, +std::string arm::getARMTargetCPU(const ArgList &Args, const llvm::Triple &Triple) { // FIXME: Warn on inconsistent use of -mcpu and -march. // If we have -mcpu=, use that. if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) { - StringRef MCPU = A->getValue(); + std::string MCPU = StringRef(A->getValue()).lower(); // Handle -mcpu=native. if (MCPU == "native") return llvm::sys::getHostCPUName(); @@ -7255,7 +7255,7 @@ void netbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA, case llvm::Triple::armeb: case llvm::Triple::thumb: case llvm::Triple::thumbeb: { - std::string MArch(arm::getARMTargetCPU(Args, getToolChain().getTriple())); + std::string MArch = arm::getARMTargetCPU(Args, getToolChain().getTriple()); CmdArgs.push_back(Args.MakeArgString("-mcpu=" + MArch)); break; } @@ -7602,7 +7602,7 @@ void gnutools::Assemble::ConstructJob(Compilation &C, const JobAction &JA, // march from being picked in the absence of a cpu flag. Arg *A; if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) && - StringRef(A->getValue()) == "krait") + StringRef(A->getValue()).lower() == "krait") CmdArgs.push_back("-march=armv7-a"); else Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ); |