[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 07:16:01 PDT 2024


================
@@ -0,0 +1,10 @@
+; RUN: not llvm-as --disable-output %s 2>&1 | FileCheck %s -DFILE=%s
+
+ at B = external global i32
+
+*/
+
+/*   /* Nested comments not supported */
+
+; CHECK: [[FILE]]:[[@LINE+1]]:1: error: redefinition of global '@B'
----------------
jurahul wrote:

Looking at Clang Lexer, it has:

```
      // If this is a /* inside of the comment, emit a warning.  Don't do this
      // if this is a /*/, which will end the comment.  This misses cases with
      // embedded escaped newlines, but oh well.```
```

So if we add the `/*` within `/*...*/` comment check, we just need to handle this case of allowing `/*/` to terminate the comment.

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


More information about the llvm-commits mailing list