From 431fb79151297df73530ca45b57f7481fc5a9bd3 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Mon, 21 Apr 2014 22:29:45 +0000 Subject: [PATCH] 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 --- lib/Basic/Targets.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- 2.50.1