diff options
author | Javed Absar <javed.absar@arm.com> | 2019-03-26 10:49:09 +0000 |
---|---|---|
committer | Javed Absar <javed.absar@arm.com> | 2019-03-26 10:49:09 +0000 |
commit | 33888ff66b1950da4af2025da5d368f6a0038fd1 (patch) | |
tree | d3d6bdd0bcf07f45e384b32ace60e9bf2ebf1d45 /llvm/lib/TableGen/TGParser.cpp | |
parent | 5c9023847919d710e8d77e710da4a1a0078e57e8 (diff) | |
download | bcm5719-llvm-33888ff66b1950da4af2025da5d368f6a0038fd1.tar.gz bcm5719-llvm-33888ff66b1950da4af2025da5d368f6a0038fd1.zip |
[TableGen] Give meaningful msg for def use in multiclass
When one mistakenly specifies 'def' instead of using 'defm',
the error message is quite misleading: 'Couldn't find class..'
Instead, it should recommend using defm if the multiclass of
same name exists.
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D59294
llvm-svn: 356985
Diffstat (limited to 'llvm/lib/TableGen/TGParser.cpp')
-rw-r--r-- | llvm/lib/TableGen/TGParser.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp index 90c9b390e10..3fc2e53f208 100644 --- a/llvm/lib/TableGen/TGParser.cpp +++ b/llvm/lib/TableGen/TGParser.cpp @@ -536,8 +536,14 @@ Record *TGParser::ParseClassID() { } Record *Result = Records.getClass(Lex.getCurStrVal()); - if (!Result) - TokError("Couldn't find class '" + Lex.getCurStrVal() + "'"); + if (!Result) { + std::string Msg("Couldn't find class '" + Lex.getCurStrVal() + "'"); + if (MultiClasses[Lex.getCurStrVal()].get()) + TokError(Msg + ". Use 'defm' if you meant to use multiclass '" + + Lex.getCurStrVal() + "'"); + else + TokError(Msg); + } Lex.Lex(); return Result; |