summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2009-10-12 16:46:55 +0000
committerTanya Lattner <tonic@nondot.org>2009-10-12 16:46:55 +0000
commitd51a6f1a95cfed54a1fedb353eabfc3fe7d70afc (patch)
tree6e0d66b7de4d24b982e869babdd32e5385fcbab3
parentMerge 83391 from mainline. (diff)
downloadllvm-project-d51a6f1a95cfed54a1fedb353eabfc3fe7d70afc.tar.gz
llvm-project-d51a6f1a95cfed54a1fedb353eabfc3fe7d70afc.tar.bz2
llvm-project-d51a6f1a95cfed54a1fedb353eabfc3fe7d70afc.zip
Merge 83417 from mainline.
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: 83859
-rw-r--r--llvm/lib/Support/Triple.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index 6fde0c9eabda..eb3d9ca2673b 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/lib/Support/Triple.cpp
@@ -9,6 +9,7 @@
#include "llvm/ADT/Triple.h"
+#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include <cassert>
#include <cstring>
@@ -326,10 +327,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) {