[PATCH] D47429: TableGen: add some more helpful error messages

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 29 10:16:33 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL333436: TableGen: add some more helpful error messages (authored by nha, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D47429

Files:
  llvm/trunk/lib/TableGen/TGParser.cpp


Index: llvm/trunk/lib/TableGen/TGParser.cpp
===================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp
+++ llvm/trunk/lib/TableGen/TGParser.cpp
@@ -428,6 +428,13 @@
   Rec->resolveReferences();
   checkConcrete(*Rec);
 
+  if (!isa<StringInit>(Rec->getNameInit())) {
+    PrintError(Rec->getLoc(), Twine("record name '") +
+                                  Rec->getNameInit()->getAsString() +
+                                  "' could not be fully resolved");
+    return true;
+  }
+
   // If ObjectBody has template arguments, it's an error.
   assert(Rec->getTemplateArgs().empty() && "How'd this get template args?");
 
@@ -2299,9 +2306,15 @@
     Lex.Lex(); // eat the ','
 
     // Read the following declarations.
+    SMLoc Loc = Lex.getLoc();
     TemplArg = ParseDeclaration(CurRec, true/*templateargs*/);
     if (!TemplArg)
       return true;
+
+    if (TheRecToAddTo->isTemplateArg(TemplArg))
+      return Error(Loc, "template argument with the same name has already been "
+                        "defined");
+
     TheRecToAddTo->addTemplateArg(TemplArg);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47429.148937.patch
Type: text/x-patch
Size: 1134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180529/a2cc9c82/attachment.bin>


More information about the llvm-commits mailing list