Skip to content

Commit 1d967c7

Browse files
committed
CLI capitalization and {} initialization
1 parent 52479d3 commit 1d967c7

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

flang/include/flang/Common/enum-class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ constexpr std::array<std::string_view, ITEMS> EnumNames(const char *p) {
7272
return NAME##_names[static_cast<std::size_t>(e)]; \
7373
} \
7474
[[maybe_unused]] inline void ForEach##NAME(std::function<void(NAME)> f) { \
75-
for (std::size_t i = 0; i < NAME##_enumSize; ++i) { \
75+
for (std::size_t i{0}; i < NAME##_enumSize; ++i) { \
7676
f(static_cast<NAME>(i)); \
7777
} \
7878
}

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,19 @@ class LanguageFeatureControl {
117117
bool ShouldWarn(UsageWarning w) const { return warnUsage_.test(w); }
118118
// CLI options
119119
bool ApplyCLIOption(std::string input);
120-
void AddAlternativeCliSpelling(LanguageFeature f, std::string input) {
120+
void AddAlternativeCLISpelling(LanguageFeature f, std::string input) {
121121
cliOptions_.insert({input, {f}});
122122
}
123-
void AddAlternativeCliSpelling(UsageWarning w, std::string input) {
123+
void AddAlternativeCLISpelling(UsageWarning w, std::string input) {
124124
cliOptions_.insert({input, {w}});
125125
}
126-
void ReplaceCliCanonicalSpelling(LanguageFeature f, std::string input);
127-
void ReplaceCliCanonicalSpelling(UsageWarning w, std::string input);
128-
std::string_view getDefaultCliSpelling(LanguageFeature f) const {
129-
return languageFeatureCliCanonicalSpelling_[EnumToInt(f)];
126+
void ReplaceCLICanonicalSpelling(LanguageFeature f, std::string input);
127+
void ReplaceCLICanonicalSpelling(UsageWarning w, std::string input);
128+
std::string_view getDefaultCLISpelling(LanguageFeature f) const {
129+
return languageFeatureCLICanonicalSpelling_[EnumToInt(f)];
130130
};
131-
std::string_view getDefaultCliSpelling(UsageWarning w) const {
132-
return usageWarningCliCanonicalSpelling_[EnumToInt(w)];
131+
std::string_view getDefaultCLISpelling(UsageWarning w) const {
132+
return usageWarningCLICanonicalSpelling_[EnumToInt(w)];
133133
};
134134
// Return all spellings of operators names, depending on features enabled
135135
std::vector<const char *> GetNames(LogicalOperator) const;
@@ -142,9 +142,9 @@ class LanguageFeatureControl {
142142
cliOptions_;
143143
// These two arrays map the enum values to their cannonical CLI spellings.
144144
std::array<std::string_view, LanguageFeature_enumSize>
145-
languageFeatureCliCanonicalSpelling_;
145+
languageFeatureCLICanonicalSpelling_;
146146
std::array<std::string_view, UsageWarning_enumSize>
147-
usageWarningCliCanonicalSpelling_;
147+
usageWarningCLICanonicalSpelling_;
148148
LanguageFeatures disable_;
149149
LanguageFeatures warnLanguage_;
150150
bool warnAllLanguage_{false};

flang/lib/Support/Fortran-features.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ bool LanguageFeatureControl::ApplyCLIOption(std::string input) {
162162
negated = true;
163163
input = input.substr(3);
164164
}
165-
if (auto it = cliOptions_.find(input); it != cliOptions_.end()) {
165+
if (auto it{cliOptions_.find(input)}; it != cliOptions_.end()) {
166166
if (std::holds_alternative<LanguageFeature>(it->second)) {
167167
EnableWarning(std::get<LanguageFeature>(it->second), !negated);
168168
return true;
@@ -175,15 +175,15 @@ bool LanguageFeatureControl::ApplyCLIOption(std::string input) {
175175
return false;
176176
}
177177

178-
void LanguageFeatureControl::ReplaceCliCanonicalSpelling(
178+
void LanguageFeatureControl::ReplaceCLICanonicalSpelling(
179179
LanguageFeature f, std::string input) {
180180
std::string_view old{languageFeatureCliCanonicalSpelling_[EnumToInt(f)]};
181181
cliOptions_.erase(std::string{old});
182182
languageFeatureCliCanonicalSpelling_[EnumToInt(f)] = input;
183183
cliOptions_.insert({input, {f}});
184184
}
185185

186-
void LanguageFeatureControl::ReplaceCliCanonicalSpelling(
186+
void LanguageFeatureControl::ReplaceCLICanonicalSpelling(
187187
UsageWarning w, std::string input) {
188188
std::string_view old{usageWarningCliCanonicalSpelling_[EnumToInt(w)]};
189189
cliOptions_.erase(std::string{old});

0 commit comments

Comments
 (0)