diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2009-10-06 21:45:26 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2009-10-06 21:45:26 +0000 |
commit | e2595b5be6a6796e864afe5e9eee0197a9a2947e (patch) | |
tree | 2b37783cd63e8c9db44a3ebda0b9a5b1c1c94699 /llvm/lib/Support | |
parent | 27c26e9a09f99a6161ad9fe9d5fa5cd331214a75 (diff) | |
download | bcm5719-llvm-e2595b5be6a6796e864afe5e9eee0197a9a2947e.tar.gz bcm5719-llvm-e2595b5be6a6796e864afe5e9eee0197a9a2947e.zip |
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
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/Triple.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index 804769d04e9..6f805da3329 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> @@ -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) { |