diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 9d9a20183f0f..6dc430c8057f 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -4776,20 +4776,18 @@ bool X86AsmParser::parseDirectiveFPOProc(SMLoc L) { return true; if (!isUIntN(32, ParamsSize)) return Parser.TokError("parameters size out of range"); - if (Parser.parseEOL("unexpected tokens")) - return addErrorSuffix(" in '.cv_fpo_proc' directive"); + if (parseEOL()) + return true; MCSymbol *ProcSym = getContext().getOrCreateSymbol(ProcName); return getTargetStreamer().emitFPOProc(ProcSym, ParamsSize, L); } // .cv_fpo_setframe ebp bool X86AsmParser::parseDirectiveFPOSetFrame(SMLoc L) { - MCAsmParser &Parser = getParser(); unsigned Reg; SMLoc DummyLoc; - if (ParseRegister(Reg, DummyLoc, DummyLoc) || - Parser.parseEOL("unexpected tokens")) - return addErrorSuffix(" in '.cv_fpo_setframe' directive"); + if (ParseRegister(Reg, DummyLoc, DummyLoc) || parseEOL()) + return true; return getTargetStreamer().emitFPOSetFrame(Reg, L); } @@ -4798,9 +4796,8 @@ bool X86AsmParser::parseDirectiveFPOPushReg(SMLoc L) { MCAsmParser &Parser = getParser(); unsigned Reg; SMLoc DummyLoc; - if (ParseRegister(Reg, DummyLoc, DummyLoc) || - Parser.parseEOL("unexpected tokens")) - return addErrorSuffix(" in '.cv_fpo_pushreg' directive"); + if (ParseRegister(Reg, DummyLoc, DummyLoc) || parseEOL()) + return true; return getTargetStreamer().emitFPOPushReg(Reg, L); } @@ -4808,9 +4805,8 @@ bool X86AsmParser::parseDirectiveFPOPushReg(SMLoc L) { bool X86AsmParser::parseDirectiveFPOStackAlloc(SMLoc L) { MCAsmParser &Parser = getParser(); int64_t Offset; - if (Parser.parseIntToken(Offset, "expected offset") || - Parser.parseEOL("unexpected tokens")) - return addErrorSuffix(" in '.cv_fpo_stackalloc' directive"); + if (Parser.parseIntToken(Offset, "expected offset") || parseEOL()) + return true; return getTargetStreamer().emitFPOStackAlloc(Offset, L); } @@ -4818,25 +4814,24 @@ bool X86AsmParser::parseDirectiveFPOStackAlloc(SMLoc L) { bool X86AsmParser::parseDirectiveFPOStackAlign(SMLoc L) { MCAsmParser &Parser = getParser(); int64_t Offset; - if (Parser.parseIntToken(Offset, "expected offset") || - Parser.parseEOL("unexpected tokens")) - return addErrorSuffix(" in '.cv_fpo_stackalign' directive"); + if (Parser.parseIntToken(Offset, "expected offset") || parseEOL()) + return true; return getTargetStreamer().emitFPOStackAlign(Offset, L); } // .cv_fpo_endprologue bool X86AsmParser::parseDirectiveFPOEndPrologue(SMLoc L) { MCAsmParser &Parser = getParser(); - if (Parser.parseEOL("unexpected tokens")) - return addErrorSuffix(" in '.cv_fpo_endprologue' directive"); + if (Parser.parseEOL()) + return true; return getTargetStreamer().emitFPOEndPrologue(L); } // .cv_fpo_endproc bool X86AsmParser::parseDirectiveFPOEndProc(SMLoc L) { MCAsmParser &Parser = getParser(); - if (Parser.parseEOL("unexpected tokens")) - return addErrorSuffix(" in '.cv_fpo_endproc' directive"); + if (Parser.parseEOL()) + return true; return getTargetStreamer().emitFPOEndProc(L); } diff --git a/llvm/test/MC/COFF/cv-fpo-errors.s b/llvm/test/MC/COFF/cv-fpo-errors.s index e2b1a8f1eaa7..5f8c9f0b6fdd 100644 --- a/llvm/test/MC/COFF/cv-fpo-errors.s +++ b/llvm/test/MC/COFF/cv-fpo-errors.s @@ -9,7 +9,7 @@ _foo: .cv_fpo_proc _foo extra # CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: expected parameter byte count .cv_fpo_proc _foo 4 extra - # CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: unexpected tokens + # CHECK: :[[#@LINE-1]]:22: error: expected newline .cv_fpo_proc _foo 4 pushl %ebp @@ -21,17 +21,17 @@ _foo: .cv_fpo_stackalloc asdf # CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: expected offset .cv_fpo_stackalloc 20 asdf - # CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: unexpected tokens + # CHECK: :[[#@LINE-1]]:24: error: expected newline .cv_fpo_stackalloc 20 .cv_fpo_endprologue asdf - # CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: unexpected tokens + # CHECK: :[[#@LINE-1]]:22: error: expected newline .cv_fpo_endprologue addl $20, %esp popl %ebp retl .cv_fpo_endproc asdf - # CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: unexpected tokens + # CHECK: :[[#@LINE-1]]:18: error: expected newline .cv_fpo_endproc .section .debug$S,"dr"