]> granicus.if.org Git - clang/commitdiff
Try to fix bad Twine usage in r206791 with std::string
authorReid Kleckner <reid@kleckner.net>
Mon, 21 Apr 2014 22:29:45 +0000 (22:29 +0000)
committerReid Kleckner <reid@kleckner.net>
Mon, 21 Apr 2014 22:29:45 +0000 (22:29 +0000)
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

index 91148b015677d94d2aa5503f8405011fef4f3ff1..7d20f045c49932aed64aeafce3705b9540ce1436 100644 (file)
@@ -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);
     }