From 7eba3f90ae8e8af5e569eb8407d7e3a40372fba0 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Tue, 6 May 2014 02:37:26 +0000 Subject: Revert "Walk back commits for unused function parameters - they're still being" this reapplies 208012 and 208002. llvm-svn: 208037 --- llvm/lib/MC/SubtargetFeature.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'llvm/lib/MC/SubtargetFeature.cpp') diff --git a/llvm/lib/MC/SubtargetFeature.cpp b/llvm/lib/MC/SubtargetFeature.cpp index 6af92c74a42..dd69b0fe8c0 100644 --- a/llvm/lib/MC/SubtargetFeature.cpp +++ b/llvm/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 &V, const StringRef S) { @@ -109,13 +97,11 @@ static std::string Join(const std::vector &V) { } /// Adding features. -void SubtargetFeatures::AddFeature(const StringRef String, - bool IsEnabled) { - // Don't add empty features - if (!String.empty()) { - // Convert to lowercase, prepend flag and add to vector - Features.push_back(PrependFlag(String.lower(), IsEnabled)); - } +void SubtargetFeatures::AddFeature(const StringRef String) { + // 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. -- cgit v1.2.3