Replace a hand rolled loop with a lovely StringRef helper we have these
authorChandler Carruth <chandlerc@gmail.com>
Tue, 21 Feb 2012 09:12:48 +0000 (09:12 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 21 Feb 2012 09:12:48 +0000 (09:12 +0000)
days. No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151048 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Triple.cpp

index 11cbb5f6c1b05b66c4e57bf59a4314db0a40322b..72f31314517f090478a7685f024fd40baf3d47a2 100644 (file)
@@ -335,10 +335,7 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
 std::string Triple::normalize(StringRef Str) {
   // Parse into components.
   SmallVector<StringRef, 4> Components;
-  for (size_t First = 0, Last = 0; Last != StringRef::npos; First = Last + 1) {
-    Last = Str.find('-', First);
-    Components.push_back(Str.slice(First, Last));
-  }
+  Str.split(Components, "-");
 
   // If the first component corresponds to a known architecture, preferentially
   // use it for the architecture.  If the second component corresponds to a