[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:38 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};
+    while (!ach && j < aSize) {
+      ach = GetWarningChar(a[j++]);
     }
-    auto bch{GetWarningChar(*b)};
-    while (!bch && *b) {
-      bch = GetWarningChar(*++b);
+    optional<char> bch{};
+    while (!bch && k < bSize) {
+      bch = GetWarningChar(b[k++]);
     }
     if (!ach && !bch) {
       return true;
     } else if (!ach || !bch || *ach != *bch) {
       return false;
     }
-    ++a, ++b;
+    ach = bch = nullopt;
----------------
klausler wrote:

`ach.reset(), bch.reset();`

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


More information about the flang-commits mailing list