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

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Sat May 31 13:17:37 PDT 2025


================
@@ -107,44 +114,138 @@ static std::optional<char> GetWarningChar(char ch) {
   }
 }
 
-static bool WarningNameMatch(const char *a, const char *b) {
+// Check for case and punctuation insensitive string equality.
+// NB, b is probably not null terminated, so don't treat is like a C string.
+static bool InsensitiveWarningNameMatch(
+    std::string_view a, std::string_view b) {
+  size_t j{0}, aSize{a.size()}, k{0}, bSize{b.size()};
   while (true) {
-    auto ach{GetWarningChar(*a)};
-    while (!ach && *a) {
-      ach = GetWarningChar(*++a);
+    optional<char> ach{nullopt};
----------------
klausler wrote:

It's `std::optional` outside of the runtime.

You don't need to initialize a `std::optional<>` to `std::nullopt` -- it's implied.

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


More information about the flang-commits mailing list