TableGen: AsmMatcher diagnostic when missing instruction mnemonic.
authorJim Grosbach <grosbach@apple.com>
Sun, 6 May 2012 17:33:14 +0000 (17:33 +0000)
committerJim Grosbach <grosbach@apple.com>
Sun, 6 May 2012 17:33:14 +0000 (17:33 +0000)
Previously, if an instruction definition was missing the mnemonic,
the next line would just assert(). Issue a real diagnostic instead.

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

utils/TableGen/AsmMatcherEmitter.cpp

index 0cb86d03d72d0d8448dd7b79a0b45462d9c36e30..96e882b19fd13848968a1b93f2efab5f5a17ea1d 100644 (file)
@@ -825,6 +825,9 @@ void MatchableInfo::tokenizeAsmString(const AsmMatcherInfo &Info) {
     throw TGError(TheDef->getLoc(),
                   "Instruction '" + TheDef->getName() + "' has no tokens");
   Mnemonic = AsmOperands[0].Token;
+  if (Mnemonic.empty())
+    throw TGError(TheDef->getLoc(),
+                  "Missing instruction mnemonic");
   // FIXME : Check and raise an error if it is a register.
   if (Mnemonic[0] == '$')
     throw TGError(TheDef->getLoc(),