MC: change runtime check to an assertion
authorSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 17 Mar 2014 17:13:57 +0000 (17:13 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 17 Mar 2014 17:13:57 +0000 (17:13 +0000)
It is unclear how it would be possible to get M to be NULL in normal scenarios.
Change this to an assert rather than a runtime check as per dblakie's
suggestion.

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

lib/MC/MCParser/AsmParser.cpp

index fbbd4365bcbd4beab3eb20b4778a69cc97d8cd6e..665e3d33d88d167203402914c5435bec2f4a04b4 100644 (file)
@@ -1998,9 +1998,10 @@ bool AsmParser::parseMacroArguments(const MCAsmMacro *M,
           break;
 
       if (FAI >= NParameters) {
+       assert(M && "expected macro to be defined");
         Error(IDLoc,
               "parameter named '" + FA.Name + "' does not exist for macro '" +
-              (M ? M->Name : "<unnamed>") + "'");
+              M->Name + "'");
         return true;
       }
       PI = FAI;