[llvm] r209309 - MC: loosen an overzealous assertion
Saleem Abdulrasool
compnerd at compnerd.org
Wed May 21 10:53:19 PDT 2014
Author: compnerd
Date: Wed May 21 12:53:18 2014
New Revision: 209309
URL: http://llvm.org/viewvc/llvm-project?rev=209309&view=rev
Log:
MC: loosen an overzealous assertion
Permit active macro expansions when terminating the assembler if there were
errors during the expansion. This would only trigger on invalid input when
built with assertions.
Added:
llvm/trunk/test/MC/AsmParser/invalid-input-assertion.s
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=209309&r1=209308&r2=209309&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Wed May 21 12:53:18 2014
@@ -528,7 +528,8 @@ AsmParser::AsmParser(SourceMgr &_SM, MCC
}
AsmParser::~AsmParser() {
- assert(ActiveMacros.empty() && "Unexpected active macro instantiation!");
+ assert((HadError || ActiveMacros.empty()) &&
+ "Unexpected active macro instantiation!");
// Destroy any macros.
for (StringMap<MCAsmMacro *>::iterator it = MacroMap.begin(),
Added: llvm/trunk/test/MC/AsmParser/invalid-input-assertion.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/invalid-input-assertion.s?rev=209309&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/invalid-input-assertion.s (added)
+++ llvm/trunk/test/MC/AsmParser/invalid-input-assertion.s Wed May 21 12:53:18 2014
@@ -0,0 +1,10 @@
+// RUN: not llvm-mc -triple i686-linux -o /dev/null %s
+// REQUIRES: asserts
+
+ .macro macro parameter=0
+ .if \parameter
+ .else
+ .endm
+
+ macro 1
+
More information about the llvm-commits
mailing list