File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -126,10 +126,10 @@ class LanguageFeatureControl {
126126 bool ShouldWarn (UsageWarning w) const { return warnUsage_.test (w); }
127127 // Cli options
128128 // Find a warning by its Cli spelling, i.e. '[no-]warning-name'.
129- std::optional<WarningAndEnabled> FindWarning (std::string input);
129+ std::optional<WarningAndEnabled> FindWarning (std::string_view input);
130130 // Take a string from the Cli and apply it to the LanguageFeatureControl.
131131 // Return true if the option was recognized (and hence applied).
132- bool EnableWarning (std::string input);
132+ bool EnableWarning (std::string_view input);
133133 // The add and replace functions are not currently used but are provided
134134 // to allow a flexible many-to-one mapping from Cli spellings to enum values.
135135 // Taking a string by value because the functions own this string after the
Original file line number Diff line number Diff line change @@ -152,19 +152,19 @@ LanguageFeatureControl::LanguageFeatureControl() {
152152}
153153
154154std::optional<std::pair<Warning, bool >> LanguageFeatureControl::FindWarning (
155- std::string input) {
155+ std::string_view input) {
156156 bool negated{false };
157157 if (input.size () > 3 && input.substr (0 , 3 ) == " no-" ) {
158158 negated = true ;
159159 input = input.substr (3 );
160160 }
161- if (auto it{cliOptions_.find (input)}; it != cliOptions_.end ()) {
161+ if (auto it{cliOptions_.find (std::string{ input} )}; it != cliOptions_.end ()) {
162162 return std::make_pair (it->second , !negated);
163163 }
164164 return std::nullopt ;
165165}
166166
167- bool LanguageFeatureControl::EnableWarning (std::string input) {
167+ bool LanguageFeatureControl::EnableWarning (std::string_view input) {
168168 if (auto warningAndEnabled{FindWarning (input)}) {
169169 EnableWarning (warningAndEnabled->first , warningAndEnabled->second );
170170 return true ;
You can’t perform that action at this time.
0 commit comments