[llvm-commits] [llvm] r83417 - /llvm/trunk/lib/Support/Triple.cpp

Tanya M. Lattner tonic at nondot.org
Thu Oct 8 11:02:01 PDT 2009


Chris can you approve or deny this patch?

Also, are both patches required or just the last one?

Thanks,
Tanya

On Tue, 6 Oct 2009, Jeffrey Yasskin wrote:

> Here's the real twine fix, in case you want it for the 2.6 branch.
>
> On Tue, Oct 6, 2009 at 2:45 PM, Jeffrey Yasskin <jyasskin at google.com> wrote:
>> Author: jyasskin
>> Date: Tue Oct  6 16:45:26 2009
>> New Revision: 83417
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=83417&view=rev
>> Log:
>> r83391 was completely broken since Twines keep references to their inputs, and
>> some of the inputs were temporaries.  Here's a real fix for the miscompilation.
>> Thanks to sabre for pointing out the problem.
>>
>> Modified:
>>    llvm/trunk/lib/Support/Triple.cpp
>>
>> Modified: llvm/trunk/lib/Support/Triple.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=83417&r1=83416&r2=83417&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Support/Triple.cpp (original)
>> +++ llvm/trunk/lib/Support/Triple.cpp Tue Oct  6 16:45:26 2009
>> @@ -9,6 +9,7 @@
>>
>>  #include "llvm/ADT/Triple.h"
>>
>> +#include "llvm/ADT/SmallString.h"
>>  #include "llvm/ADT/Twine.h"
>>  #include <cassert>
>>  #include <cstring>
>> @@ -390,10 +391,14 @@
>>  }
>>
>>  void Triple::setArchName(const StringRef &Str) {
>> -  // Work around a miscompilation bug in gcc 4.0.3.
>> -  Twine a = getVendorName() + "-" + getOSAndEnvironmentName();
>> -  Twine b = Str + "-" + a;
>> -  setTriple(b);
>> +  // Work around a miscompilation bug for Twines in gcc 4.0.3.
>> +  SmallString<64> Triple;
>> +  Triple += Str;
>> +  Triple += "-";
>> +  Triple += getVendorName();
>> +  Triple += "-";
>> +  Triple += getOSAndEnvironmentName();
>> +  setTriple(Triple.str());
>>  }
>>
>>  void Triple::setVendorName(const StringRef &Str) {
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>


More information about the llvm-commits mailing list