[llvm-commits] [llvm] r151048 - /llvm/trunk/lib/Support/Triple.cpp

Chandler Carruth chandlerc at gmail.com
Tue Feb 21 01:12:48 PST 2012


Author: chandlerc
Date: Tue Feb 21 03:12:48 2012
New Revision: 151048

URL: http://llvm.org/viewvc/llvm-project?rev=151048&view=rev
Log:
Replace a hand rolled loop with a lovely StringRef helper we have these
days. No functionality changed.

Modified:
    llvm/trunk/lib/Support/Triple.cpp

Modified: llvm/trunk/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=151048&r1=151047&r2=151048&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Tue Feb 21 03:12:48 2012
@@ -335,10 +335,7 @@
 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





More information about the llvm-commits mailing list