Skip to content

Commit f4f69cd

Browse files
committed
minor tweeks
1 parent e8b450f commit f4f69cd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

flang/include/flang/Support/Fortran-features.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

flang/lib/Support/Fortran-features.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,19 @@ LanguageFeatureControl::LanguageFeatureControl() {
152152
}
153153

154154
std::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;

0 commit comments

Comments
 (0)