[flang-commits] [flang] [Flang] Fix -Wopen-mp-* and -Wopen-acc-* flag spellings (PR #188434)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Thu Mar 26 08:30:42 PDT 2026


================
@@ -1048,6 +1048,17 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
         const unsigned diagID = diags.getCustomDiagID(
             clang::DiagnosticsEngine::Error, "Unknown diagnostic option: -W%0");
         diags.Report(diagID) << wArg;
+      } else {
+        if (auto canonical{features.GetCanonicalSpelling(wArg)}) {
+          std::string suggestion{*canonical};
+          if (wArg.size() > 3 && wArg.substr(0, 3) == "no-") {
----------------
tarunprabhu wrote:

My mistake. I thought that `getAllArgValues` returned `StringRef`s, but looks like it returns a `std::string`'s. Leaving it as `substr` is probably better than making a `StringRef` just to use `starts_with`, but I don't have a strong opinion either way. 

(tries not to build up a head of steam about `auto`).

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


More information about the flang-commits mailing list