[flang-commits] [flang] [flang][CLI] Have the CLI hint the flag to disable a warning (PR #144767)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Jun 18 11:21:27 PDT 2025


================
@@ -273,14 +273,36 @@ static llvm::raw_ostream::Colors PrefixColor(Severity severity) {
   return llvm::raw_ostream::SAVEDCOLOR;
 }
 
+static std::string hintLanguageControlFlag(
+  const common::LanguageFeatureControl *hintFlagPtr, 
+  std::optional<common::LanguageFeature> feature,
+  std::optional<common::UsageWarning> warning) {
+  if (hintFlagPtr) {
+    std::string_view flag{""};
+    if (warning) {
+      flag = hintFlagPtr->getDefaultCliSpelling(*warning);
+    } else if (feature) {
+      flag = hintFlagPtr->getDefaultCliSpelling(*feature);
+    }
+    if (!flag.empty()) {
+      std::string s{" [-Wno-" + std::string(flag) + "]"};
+      llvm::errs() << "hint: " << s << "\n";
----------------
klausler wrote:

Is `hint:` useful or necessary?  Does clang emit `hint:`?

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


More information about the flang-commits mailing list