[llvm] r204060 - MC: change runtime check to an assertion

Saleem Abdulrasool compnerd at compnerd.org
Mon Mar 17 10:13:57 PDT 2014


Author: compnerd
Date: Mon Mar 17 12:13:57 2014
New Revision: 204060

URL: http://llvm.org/viewvc/llvm-project?rev=204060&view=rev
Log:
MC: change runtime check to an assertion

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.

Modified:
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=204060&r1=204059&r2=204060&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon Mar 17 12:13:57 2014
@@ -1998,9 +1998,10 @@ bool AsmParser::parseMacroArguments(cons
           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;





More information about the llvm-commits mailing list