[flang-commits] [flang] [flang][cli] Add diagnostic flags to the CLI (PR #142022)

Andre Kuhlenschmidt via flang-commits flang-commits at lists.llvm.org
Thu Jun 5 13:51:03 PDT 2025


================
@@ -108,26 +106,51 @@ class LanguageFeatureControl {
     warnAllUsage_ = false;
     warnUsage_.clear();
   }
-
+  void DisableAllWarnings() {
+    disableAllWarnings_ = true;
+    DisableAllNonstandardWarnings();
+    DisableAllUsageWarnings();
+  }
+  bool AreWarningsDisabled() const { return disableAllWarnings_; }
   bool IsEnabled(LanguageFeature f) const { return !disable_.test(f); }
-  bool ShouldWarn(LanguageFeature f) const {
-    return (warnAllLanguage_ && f != LanguageFeature::OpenMP &&
-               f != LanguageFeature::OpenACC && f != LanguageFeature::CUDA) ||
-        warnLanguage_.test(f);
+  bool ShouldWarn(LanguageFeature f) const { return warnLanguage_.test(f); }
+  bool ShouldWarn(UsageWarning w) const { return warnUsage_.test(w); }
+  // CLI options
+  bool ApplyCLIOption(std::string input);
+  void AddAlternativeCliSpelling(LanguageFeature f, std::string input) {
+    cliOptions_.insert({input, {f}});
   }
-  bool ShouldWarn(UsageWarning w) const {
-    return warnAllUsage_ || warnUsage_.test(w);
+  void AddAlternativeCliSpelling(UsageWarning w, std::string input) {
+    cliOptions_.insert({input, {w}});
   }
+  void ReplaceCliCanonicalSpelling(LanguageFeature f, std::string input);
----------------
akuhlens wrote:

I have adjusted all uses to upper case because that matches the use of camel case elsewhere (`UsageWarning` names for example). There is still an outstanding discrepancy in `cliOptions_` variable name which starts with lowercase because it is a private data member which seem to usually be lower case camel case. I would be happy to leave it as is, change it to `CLIOptions`, change all uses of `CLI` to `Cli` and leave all `cliOptions` alone, or sidestep the issue by avoiding "cli" all together. Are you fine with how it is? If not, do you have a preference of how I fix this?

https://github.com/llvm/llvm-project/pull/142022


More information about the flang-commits mailing list