[PATCH] D47429: TableGen: add some more helpful error messages
Nicolai Hähnle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 29 08:54:31 PDT 2018
nhaehnle updated this revision to Diff 148921.
nhaehnle marked an inline comment as done.
nhaehnle added a comment.
Fix typo.
Repository:
rL LLVM
https://reviews.llvm.org/D47429
Files:
lib/TableGen/TGParser.cpp
Index: lib/TableGen/TGParser.cpp
===================================================================
--- lib/TableGen/TGParser.cpp
+++ 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.148921.patch
Type: text/x-patch
Size: 1101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180529/0c0fea3e/attachment.bin>
More information about the llvm-commits
mailing list