[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 14:17:49 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:

Never mind, searching for `CLI` throughout the code base indicates it is usually spelled `Cli` so I have moved to that, which seems consistent with `cliOptions` when you account for the lower casing non-public members. So I am going to call this resolved. Feel free to reopen if you disagree.

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


More information about the flang-commits mailing list