[PATCH] D142321: [llvm-ml] Disallow '{' and '}' at the start of a statement

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 09:44:26 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1799a714a7a7: [llvm-ml] Disallow '{' and '}' at the start of a statement (authored by barannikov88).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142321/new/

https://reviews.llvm.org/D142321

Files:
  llvm/lib/MC/MCParser/MasmParser.cpp
  llvm/test/tools/llvm-ml/label_errors.asm


Index: llvm/test/tools/llvm-ml/label_errors.asm
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ml/label_errors.asm
@@ -0,0 +1,8 @@
+; RUN: not llvm-ml -filetype=s %s /Fo - 2>&1 \
+; RUN:   | FileCheck %s --implicit-check-not="{{[0-9]+:[0-9]+: error:}}"
+
+.code
+
+; These used to be valid label names.
+{: ; CHECK: [[@LINE]]:1: error: unexpected token at start of statement
+}: ; CHECK: [[@LINE]]:1: error: unexpected token at start of statement
Index: llvm/lib/MC/MCParser/MasmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/MasmParser.cpp
+++ llvm/lib/MC/MCParser/MasmParser.cpp
@@ -2125,20 +2125,6 @@
     // Treat '.' as a valid identifier in this context.
     Lex();
     IDVal = ".";
-  } else if (Lexer.is(AsmToken::LCurly)) {
-    // Treat '{' as a valid identifier in this context.
-    Lex();
-    IDVal = "{";
-
-  } else if (Lexer.is(AsmToken::RCurly)) {
-    // Treat '}' as a valid identifier in this context.
-    Lex();
-    IDVal = "}";
-  } else if (Lexer.is(AsmToken::Star) &&
-             getTargetParser().starIsStartOfStatement()) {
-    // Accept '*' as a valid start of statement.
-    Lex();
-    IDVal = "*";
   } else if (Lexer.is(AsmToken::Real)) {
     // Treat ".<number>" as a valid identifier in this context.
     IDVal = getTok().getString();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142321.492158.patch
Type: text/x-patch
Size: 1396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230125/d7ab5c74/attachment.bin>


More information about the llvm-commits mailing list