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 | 233b35a9018db719a4538efa59b00ba8c7582688 (patch) | |
tree | a9a6407f623153c6430f2c63739392212ce45366 /lib/Support | |
parent | fc6baa536fe873f258c8aef5cb170d1d4b67f0c4 (diff) | |
download | external_llvm-233b35a9018db719a4538efa59b00ba8c7582688.zip external_llvm-233b35a9018db719a4538efa59b00ba8c7582688.tar.gz external_llvm-233b35a9018db719a4538efa59b00ba8c7582688.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/Triple.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index 804769d..6f805da 100644 --- a/lib/Support/Triple.cpp +++ b/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) { |