[llvm] r209309 - MC: loosen an overzealous assertion

Benjamin Kramer benny.kra at gmail.com
Wed May 21 11:18:07 PDT 2014


On 21.05.2014, at 19:53, Saleem Abdulrasool <compnerd at compnerd.org> wrote:

> 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

Why does this test require assertions?

- Ben

> +
> +	.macro macro parameter=0
> +		.if \parameter
> +		.else
> +	.endm
> +
> +	macro 1
> +
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list