[clang] [clang] Diagnose problematic diagnostic messages (PR #93229)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu May 23 13:15:59 PDT 2024


================
@@ -1355,7 +1357,7 @@ static void verifyDiagnosticWording(const Record &Diag) {
   if (isDigit(FullDiagText.back()) && *(FullDiagText.end() - 2) == '}') {
     // Scan backwards to find the opening curly brace.
     size_t BraceCount = 1;
-    auto Iter = FullDiagText.end() - /*}0*/ 3;
+    auto Iter = FullDiagText.end() - sizeof("}0");
----------------
AaronBallman wrote:

It's because we want to get to the iterator just *before* the `}0`, so -2 gets us to `}` while -3 gets us to the character before the `}`.

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


More information about the cfe-commits mailing list