[flang-commits] [flang] [flang][cli] Add diagnostic flags to the CLI (PR #142022)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Thu Jun 5 13:28:25 PDT 2025
================
@@ -94,57 +154,41 @@ LanguageFeatureControl::LanguageFeatureControl() {
warnLanguage_.set(LanguageFeature::NullActualForAllocatable);
}
-// Ignore case and any inserted punctuation (like '-'/'_')
-static std::optional<char> GetWarningChar(char ch) {
- if (ch >= 'a' && ch <= 'z') {
- return ch;
- } else if (ch >= 'A' && ch <= 'Z') {
- return ch - 'A' + 'a';
- } else if (ch >= '0' && ch <= '9') {
- return ch;
- } else {
- return std::nullopt;
+// Take a string from the CLI and apply it to the LanguageFeatureControl.
+// Return true if the option was applied recognized.
+bool LanguageFeatureControl::ApplyCLIOption(std::string input) {
+ bool negated{false};
+ if (input.size() > 3 && input.substr(0, 3) == "no-") {
+ negated = true;
+ input = input.substr(3);
}
-}
-
-static bool WarningNameMatch(const char *a, const char *b) {
- while (true) {
- auto ach{GetWarningChar(*a)};
- while (!ach && *a) {
- ach = GetWarningChar(*++a);
- }
- auto bch{GetWarningChar(*b)};
- while (!bch && *b) {
- bch = GetWarningChar(*++b);
- }
- if (!ach && !bch) {
+ if (auto it = cliOptions_.find(input); it != cliOptions_.end()) {
----------------
klausler wrote:
braced initialization, please
https://github.com/llvm/llvm-project/pull/142022
More information about the flang-commits
mailing list