[llvm] [LLVM][AsmParser] Add support for C style comments (PR #111554)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 1 09:36:53 PDT 2024
================
@@ -251,6 +258,12 @@ lltok::Kind LLLexer::LexToken() {
case ',': return lltok::comma;
case '*': return lltok::star;
case '|': return lltok::bar;
+ case '/':
+ if (peekNextChar() != '*')
----------------
jurahul wrote:
This is the fix. The old code was:
```
if (peekNextChar() == '*' && SkipCComment())
return lltok::Error;
continue;
```
Given the input:
```
@B = external global i32
*/
```
The `@B = external global i32*` is a valid sequence of tokens (The * becomes a part of the i32 * type). The `/` following the * is silently eaten by the old code due to the `continue`. The fix now correctly executes `continue` only when it has successfully parsed a C style comment.
https://github.com/llvm/llvm-project/pull/111554
More information about the llvm-commits
mailing list