Index: lib/Target/Mips/AsmParser/MipsAsmParser.cpp =================================================================== --- lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -4881,6 +4881,7 @@ return false; } +//FIXME: These two functions should both either eat or not eat bool MipsAsmParser::reportParseError(Twine ErrorMsg) { MCAsmParser &Parser = getParser(); SMLoc Loc = getLexer().getLoc(); @@ -5489,7 +5490,6 @@ OperandMatchResultTy ResTy = parseAnyRegister(TmpReg); if (ResTy == MatchOperand_NoMatch) { reportParseError("expected register containing function address"); - Parser.eatToEndOfStatement(); return false; } @@ -6036,13 +6036,20 @@ } bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) { + //This returns false if we understand the directive, so even on + //errors this should return false. + MCAsmParser &Parser = getParser(); StringRef IDVal = DirectiveID.getString(); - if (IDVal == ".cpload") - return parseDirectiveCpLoad(DirectiveID.getLoc()); - if (IDVal == ".cprestore") - return parseDirectiveCpRestore(DirectiveID.getLoc()); + if (IDVal == ".cpload"){ + parseDirectiveCpLoad(DirectiveID.getLoc()); + return false; + } + if (IDVal == ".cprestore"){ + parseDirectiveCpRestore(DirectiveID.getLoc()); + return false; + } if (IDVal == ".dword") { parseDataDirective(8, DirectiveID.getLoc()); return false; @@ -6199,7 +6206,8 @@ } if (IDVal == ".set") { - return parseDirectiveSet(); + parseDirectiveSet(); + return false; } if (IDVal == ".mask" || IDVal == ".fmask") { @@ -6283,8 +6291,10 @@ return false; } - if (IDVal == ".option") - return parseDirectiveOption(); + if (IDVal == ".option"){ + parseDirectiveOption(); + return false; + } if (IDVal == ".abicalls") { getTargetStreamer().emitDirectiveAbiCalls(); @@ -6297,25 +6307,34 @@ return false; } - if (IDVal == ".cpsetup") - return parseDirectiveCPSetup(); - - if (IDVal == ".cpreturn") - return parseDirectiveCPReturn(); - - if (IDVal == ".module") - return parseDirectiveModule(); - - if (IDVal == ".llvm_internal_mips_reallow_module_directive") - return parseInternalDirectiveReallowModule(); - - if (IDVal == ".insn") - return parseInsnDirective(); - - if (IDVal == ".sbss") - return parseSSectionDirective(IDVal, ELF::SHT_NOBITS); - if (IDVal == ".sdata") - return parseSSectionDirective(IDVal, ELF::SHT_PROGBITS); + if (IDVal == ".cpsetup"){ + parseDirectiveCPSetup(); + return false; + } + if (IDVal == ".cpreturn"){ + parseDirectiveCPReturn(); + return false; + } + if (IDVal == ".module"){ + parseDirectiveModule(); + return false; + } + if (IDVal == ".llvm_internal_mips_reallow_module_directive"){ + parseInternalDirectiveReallowModule(); + return false; + } + if (IDVal == ".insn"){ + parseInsnDirective(); + return false; + } + if (IDVal == ".sbss"){ + parseSSectionDirective(IDVal, ELF::SHT_NOBITS); + return false; + } + if (IDVal == ".sdata"){ + parseSSectionDirective(IDVal, ELF::SHT_PROGBITS); + return false; + } return true; }