[PATCH] D47429: TableGen: add some more helpful error messages
Nicolai Hähnle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 27 13:45:53 PDT 2018
nhaehnle created this revision.
nhaehnle added reviewers: tra, simon_tatham, craig.topper, MartinO, arsenm.
Herald added a subscriber: wdng.
Change-Id: I6f3dacf675a4126134577616e259696bebdade3a
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 same has already been "
+ "defined");
+
TheRecToAddTo->addTemplateArg(TemplArg);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47429.148765.patch
Type: text/x-patch
Size: 1101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180527/e59f2b10/attachment.bin>
More information about the llvm-commits
mailing list