diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-24 20:45:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-24 20:45:08 +0000 |
commit | b7fbcc9696e38ca26c7eb67077c04b51c846c9cb (patch) | |
tree | 06b1860bd23af5ec578afe5c286f119bc991f48a | |
parent | 3f25ee080ca7c92ff735df29c78e7cfbd62c8cb6 (diff) | |
download | external_llvm-b7fbcc9696e38ca26c7eb67077c04b51c846c9cb.zip external_llvm-b7fbcc9696e38ca26c7eb67077c04b51c846c9cb.tar.gz external_llvm-b7fbcc9696e38ca26c7eb67077c04b51c846c9cb.tar.bz2 |
switch Triple to take twines instead of stringrefs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135889 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/ADT/Triple.h | 29 | ||||
-rw-r--r-- | lib/Support/Triple.cpp | 5 |
2 files changed, 9 insertions, 25 deletions
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index fd23608..0ad096b 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -10,8 +10,7 @@ #ifndef LLVM_ADT_TRIPLE_H #define LLVM_ADT_TRIPLE_H -#include "llvm/ADT/StringRef.h" -#include <string> +#include "llvm/ADT/Twine.h" // Some system headers or GCC predefined macros conflict with identifiers in // this file. Undefine them here. @@ -19,8 +18,6 @@ #undef sparc namespace llvm { -class StringRef; -class Twine; /// Triple - Helper class for working with target triples. /// @@ -134,24 +131,16 @@ public: /// @{ Triple() : Data(), Arch(InvalidArch) {} - explicit Triple(StringRef Str) : Data(Str), Arch(InvalidArch) {} - explicit Triple(StringRef ArchStr, StringRef VendorStr, StringRef OSStr) - : Data(ArchStr), Arch(InvalidArch) { - Data += '-'; - Data += VendorStr; - Data += '-'; - Data += OSStr; + explicit Triple(const Twine &Str) : Data(Str.str()), Arch(InvalidArch) {} + Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr) + : Data((ArchStr + Twine('-') + VendorStr + Twine('-') + OSStr).str()), + Arch(InvalidArch) { } - explicit Triple(StringRef ArchStr, StringRef VendorStr, StringRef OSStr, - StringRef EnvironmentStr) - : Data(ArchStr), Arch(InvalidArch) { - Data += '-'; - Data += VendorStr; - Data += '-'; - Data += OSStr; - Data += '-'; - Data += EnvironmentStr; + Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr, + const Twine &EnvironmentStr) + : Data((ArchStr + Twine('-') + VendorStr + Twine('-') + OSStr + Twine('-') + + EnvironmentStr).str()), Arch(InvalidArch) { } /// @} diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index 2002619..e1729bf 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -8,16 +8,11 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/Triple.h" - #include "llvm/ADT/SmallString.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/Twine.h" -#include <cassert> #include <cstring> using namespace llvm; -// - const char *Triple::getArchTypeName(ArchType Kind) { switch (Kind) { case InvalidArch: return "<invalid>"; |