[llvm] [MCParser] Share identifier character set with isMacroArgChar (PR #219084)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 21:55:17 PDT 2026


================
@@ -4902,8 +4901,8 @@ void AsmParser::checkForBadMacro(SMLoc DirectiveLoc, StringRef Name,
       }
       Pos += 2;
     } else {
-      unsigned I = Pos + 1;
-      while (isIdentifierChar(Body[I]) && I + 1 != End)
+      size_t I = Pos + 1;
----------------
zhangweize9-cyber wrote:

Actually, I would recommend using the built-in `decltype()` function here. While the code might look fine at first glance, it could potentially trigger an **off-by-one error** and lead to an infinite loop depending on the specific architecture and environment.

Although I haven't conducted specific tests to reproduce it, I believe it's still a very low-probability event.

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


More information about the llvm-commits mailing list