From: Reid Kleckner Date: Mon, 21 Apr 2014 22:29:45 +0000 (+0000) Subject: Try to fix bad Twine usage in r206791 with std::string X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=431fb79151297df73530ca45b57f7481fc5a9bd3;p=clang Try to fix bad Twine usage in r206791 with std::string I'm pretty sure I was referencing destroyed temporaries here. I'm open to suggestions on how to write this better. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206804 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 91148b0156..7d20f045c4 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -3103,7 +3103,9 @@ static void addMinGWDefines(const LangOptions &Opts, MacroBuilder &Builder) { // x64 as well as x86, even though they have no effect. const char *CCs[] = {"cdecl", "stdcall", "fastcall", "thiscall", "pascal"}; for (const char *CC : CCs) { - Twine GCCSpelling = Twine("__attribute__((__") + CC + Twine("__))"); + std::string GCCSpelling = "__attribute__((__"; + GCCSpelling += CC; + GCCSpelling += "__))"; Builder.defineMacro(Twine("_") + CC, GCCSpelling); Builder.defineMacro(Twine("__") + CC, GCCSpelling); }