[PATCH] D94412: [TableGen] Improve error message for semicolon after braced body

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 13:40:10 PST 2021


craig.topper added a comment.

Can we write tests for this?



================
Comment at: llvm/lib/TableGen/TGParser.cpp:2839
   if (!consume(tgtok::l_brace))
-    return TokError("Expected ';' or '{' to start body");
+    return TokError("Expected ';', or '{' to start body");
 
----------------
I don't think there should be a comma between two choices.


================
Comment at: llvm/lib/TableGen/TGParser.cpp:2856
+  if (consume(tgtok::semi)) {
+    PrintError(SemiLoc, "A class or def body does not end with a semicolon");
+    PrintNote("Semicolon ignored; remove to eliminate this error");    
----------------
I think "A class or def body should not end with a semicolon" reads better to me.


================
Comment at: llvm/lib/TableGen/TGParser.cpp:3446
+    if (consume(tgtok::semi)) {
+      PrintError(SemiLoc, "A multiclass body does not end with a semicolon");
+      PrintNote("Semicolon ignored; remove to eliminate this error");    
----------------
Similar here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94412



More information about the llvm-commits mailing list