1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

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.

llvm-svn: 83417
This commit is contained in:
Jeffrey Yasskin 2009-10-06 21:45:26 +00:00
parent 636d635cc1
commit c4f2348fe7

View File

@ -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::setOS(OSType Kind) {
}
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) {