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

Paul C. Anagnostopoulos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 13:59:42 PST 2021


Paul-C-Anagnostopoulos added a comment.

I will write tests for these errors.



================
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");
 
----------------
craig.topper wrote:
> I don't think there should be a comma between two choices.
Here "to start body" only applies to the second choice, so the comma disambiguates the sentence. Let me actually rewrite it so it's clear.


================
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");    
----------------
craig.topper wrote:
> I think "A class or def body should not end with a semicolon" reads better to me.
Agreed.



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