[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:05:04 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:

WDYM? Even in C: "/* hello /* this is comment */ " is a full comment. The second /* is ignored, and the comment ends at the first */. Clang does give a warnings:

```
comment.c:2:10: warning: '/*' within block comment [-Wcomment]
/* hello /* this is comment */
```

but accepts this code. Are you suggesting that we be strict and disallow /* within the /* */ comment?

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


More information about the llvm-commits mailing list