TableGen: Assembly matcher 'insufficient operands' diagnostic.
authorJim Grosbach <grosbach@apple.com>
Thu, 12 Jul 2012 21:37:20 +0000 (21:37 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 12 Jul 2012 21:37:20 +0000 (21:37 +0000)
Make sure the tblgen'erated asm matcher correctly returns numoperands+1
as the ErrorInfo when the problem was that there weren't enough operands
specified.

rdar://9142751

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160144 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmMatcherEmitter.cpp

index f5e094e486a8a5480b981d178694e4446086a678..da493b3a3b0f918af144e8045cfce0eb536a962a 100644 (file)
@@ -2649,6 +2649,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
   OS << "    for (unsigned i = 0; i != " << MaxNumOperands << "; ++i) {\n";
   OS << "      if (i + 1 >= Operands.size()) {\n";
   OS << "        OperandsValid = (it->Classes[i] == " <<"InvalidMatchClass);\n";
+  OS << "        if (!OperandsValid) ErrorInfo = i + 1;\n;";
   OS << "        break;\n";
   OS << "      }\n";
   OS << "      unsigned Diag = validateOperandClass(Operands[i+1],\n";