summaryrefslogtreecommitdiff
path: root/lib/MC
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-05-13 19:55:17 +0000
committerEric Christopher <echristo@gmail.com>2014-05-13 19:55:17 +0000
commite02c34ba2ac2f9150236eccc0f495866f85dff9a (patch)
tree78e86faa03040793b5367fe4fbab83a9a8ead16a /lib/MC
parent3e18feedfddd2bd3619d0d4294f77e533a142b49 (diff)
downloadllvm-e02c34ba2ac2f9150236eccc0f495866f85dff9a.tar.gz
llvm-e02c34ba2ac2f9150236eccc0f495866f85dff9a.tar.bz2
llvm-e02c34ba2ac2f9150236eccc0f495866f85dff9a.tar.xz
Make the split function use StringRef::split.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208723 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/SubtargetFeature.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/lib/MC/SubtargetFeature.cpp b/lib/MC/SubtargetFeature.cpp
index 3be6d9641b..27525c7f12 100644
--- a/lib/MC/SubtargetFeature.cpp
+++ b/lib/MC/SubtargetFeature.cpp
@@ -54,25 +54,9 @@ static inline bool isEnabled(const StringRef Feature) {
/// Split - Splits a string of comma separated items in to a vector of strings.
///
static void Split(std::vector<std::string> &V, const StringRef S) {
- if (S.empty())
- return;
-
- // Start at beginning of string.
- size_t Pos = 0;
- while (true) {
- // Find the next comma
- size_t Comma = S.find(',', Pos);
- // If no comma found then the rest of the string is used
- if (Comma == std::string::npos) {
- // Add string to vector
- V.push_back(S.substr(Pos));
- break;
- }
- // Otherwise add substring to vector
- V.push_back(S.substr(Pos, Comma - Pos));
- // Advance to next item
- Pos = Comma + 1;
- }
+ SmallVector<StringRef, 2> Tmp;
+ S.split(Tmp, ",", -1, false /* KeepEmpty */);
+ V.assign(Tmp.begin(), Tmp.end());
}
/// Join a vector of strings to a string with a comma separating each element.