summaryrefslogtreecommitdiff
path: root/lib/MC/SubtargetFeature.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-05-05 22:36:07 +0000
committerEric Christopher <echristo@gmail.com>2014-05-05 22:36:07 +0000
commitbb95032999e5ef066f8f4a28e106cf3484b02e5a (patch)
tree1d1e34b3f4185c9d6d65b31a027dacadfd37856f /lib/MC/SubtargetFeature.cpp
parent9edfca83f4bde8ae2f8cc601ee8e5ce40fc8c40e (diff)
downloadllvm-bb95032999e5ef066f8f4a28e106cf3484b02e5a.tar.gz
llvm-bb95032999e5ef066f8f4a28e106cf3484b02e5a.tar.bz2
llvm-bb95032999e5ef066f8f4a28e106cf3484b02e5a.tar.xz
Remove a now unnecessary function since all calls have one version
and inline it into its caller. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208012 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/SubtargetFeature.cpp')
-rw-r--r--lib/MC/SubtargetFeature.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/lib/MC/SubtargetFeature.cpp b/lib/MC/SubtargetFeature.cpp
index b7920e4073..dd69b0fe8c 100644
--- a/lib/MC/SubtargetFeature.cpp
+++ b/lib/MC/SubtargetFeature.cpp
@@ -51,18 +51,6 @@ static inline bool isEnabled(const StringRef Feature) {
return Ch == '+';
}
-/// PrependFlag - Return a string with a prepended flag; '+' or '-'.
-///
-static inline std::string PrependFlag(const StringRef Feature,
- bool IsEnabled) {
- assert(!Feature.empty() && "Empty string");
- if (hasFlag(Feature))
- return Feature;
- std::string Prefix = IsEnabled ? "+" : "-";
- Prefix += Feature;
- return Prefix;
-}
-
/// 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) {
@@ -110,11 +98,10 @@ static std::string Join(const std::vector<std::string> &V) {
/// Adding features.
void SubtargetFeatures::AddFeature(const StringRef String) {
- // Don't add empty features
- if (!String.empty()) {
- // Convert to lowercase, prepend flag and add to vector
- Features.push_back(PrependFlag(String.lower(), true));
- }
+ // Don't add empty features or features we already have.
+ if (!String.empty())
+ // Convert to lowercase, prepend flag if we don't already have a flag.
+ Features.push_back(hasFlag(String) ? String.str() : "+" + String.lower());
}
/// Find KV in array using binary search.