From: Aaron Ballman Date: Thu, 17 Jul 2014 13:28:50 +0000 (+0000) Subject: Using a std::string instead of a StringRef because the Default case synthesizes a... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c57879f0dd98cf30cdc0672ad727f150d304c1f;p=clang Using a std::string instead of a StringRef because the Default case synthesizes a temporary std::string from a Twine. Assigning that into a StringRef causes the StringRef to refer to a temporary, and bad things happen. This fixes a failing test case on Windows. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213265 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 8f0902d80d..e5db2f0e9f 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1037,12 +1037,12 @@ static void getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple, ABIName = getGnuCompatibleMipsABIName(ABIName); // Always override the backend's default ABI. - StringRef ABIFeature = llvm::StringSwitch(ABIName) - .Case("32", "+o32") - .Case("n32", "+n32") - .Case("64", "+n64") - .Case("eabi", "+eabi") - .Default(("+" + ABIName).str()); + std::string ABIFeature = llvm::StringSwitch(ABIName) + .Case("32", "+o32") + .Case("n32", "+n32") + .Case("64", "+n64") + .Case("eabi", "+eabi") + .Default(("+" + ABIName).str()); Features.push_back("-o32"); Features.push_back("-n64"); Features.push_back(Args.MakeArgString(ABIFeature));