r206804 - Try to fix bad Twine usage in r206791 with std::string

Reid Kleckner reid at kleckner.net
Mon Apr 21 15:29:45 PDT 2014


Author: rnk
Date: Mon Apr 21 17:29:45 2014
New Revision: 206804

URL: http://llvm.org/viewvc/llvm-project?rev=206804&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=206804&r1=206803&r2=206804&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Apr 21 17:29:45 2014
@@ -3103,7 +3103,9 @@ static void addMinGWDefines(const LangOp
     // 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);
     }





More information about the cfe-commits mailing list