[MC] Replace custom string join function with the one from StringExtras.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 28 May 2015 11:45:32 +0000 (11:45 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 28 May 2015 11:45:32 +0000 (11:45 +0000)
NFC.

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

lib/MC/SubtargetFeature.cpp

index 78006e0d702053b3d53cecb6ce9549ab0cfedac3..e976a508bc2f58e177b9f447f276ebd5bf36b2e3 100644 (file)
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/MC/SubtargetFeature.h"
 //===----------------------------------------------------------------------===//
 
 #include "llvm/MC/SubtargetFeature.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
@@ -59,27 +60,6 @@ static void Split(std::vector<std::string> &V, StringRef S) {
   V.assign(Tmp.begin(), Tmp.end());
 }
 
   V.assign(Tmp.begin(), Tmp.end());
 }
 
-/// Join a vector of strings to a string with a comma separating each element.
-///
-static std::string Join(const std::vector<std::string> &V) {
-  // Start with empty string.
-  std::string Result;
-  // If the vector is not empty
-  if (!V.empty()) {
-    // Start with the first feature
-    Result = V[0];
-    // For each successive feature
-    for (size_t i = 1; i < V.size(); i++) {
-      // Add a comma
-      Result += ",";
-      // Add the feature
-      Result += V[i];
-    }
-  }
-  // Return the features string
-  return Result;
-}
-
 /// Adding features.
 void SubtargetFeatures::AddFeature(StringRef String, bool Enable) {
   // Don't add empty features.
 /// Adding features.
 void SubtargetFeatures::AddFeature(StringRef String, bool Enable) {
   // Don't add empty features.
@@ -144,7 +124,7 @@ SubtargetFeatures::SubtargetFeatures(StringRef Initial) {
 
 
 std::string SubtargetFeatures::getString() const {
 
 
 std::string SubtargetFeatures::getString() const {
-  return Join(Features);
+  return join(Features.begin(), Features.end(), ",");
 }
 
 /// SetImpliedBits - For each feature that is (transitively) implied by this
 }
 
 /// SetImpliedBits - For each feature that is (transitively) implied by this