[MC] Remove unneeded "in '.xxx' directive" from diagnostics

The directive name is not useful because the next line replicates the error line
which includes the directive.
This commit is contained in:
Fangrui Song 2021-05-04 13:30:29 -07:00
parent 14ca2e5e22
commit 3d473ae72e
11 changed files with 164 additions and 179 deletions

View File

@ -2944,7 +2944,7 @@ bool AsmParser::parseDirectiveSet(StringRef IDVal, bool allow_redef) {
StringRef Name;
if (check(parseIdentifier(Name), "expected identifier") ||
parseToken(AsmToken::Comma) || parseAssignment(Name, allow_redef, true))
return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");
return true;
return false;
}
@ -3059,9 +3059,7 @@ bool AsmParser::parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) {
return false;
};
if (parseMany(parseOp))
return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");
return false;
return parseMany(parseOp);
}
/// parseDirectiveReloc
@ -3125,9 +3123,7 @@ bool AsmParser::parseDirectiveValue(StringRef IDVal, unsigned Size) {
return false;
};
if (parseMany(parseOp))
return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");
return false;
return parseMany(parseOp);
}
static bool parseHexOcta(AsmParser &Asm, uint64_t &hi, uint64_t &lo) {
@ -3169,9 +3165,7 @@ bool AsmParser::parseDirectiveOctaValue(StringRef IDVal) {
return false;
};
if (parseMany(parseOp))
return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");
return false;
return parseMany(parseOp);
}
bool AsmParser::parseRealValue(const fltSemantics &Semantics, APInt &Res) {
@ -3228,9 +3222,7 @@ bool AsmParser::parseDirectiveRealValue(StringRef IDVal,
return false;
};
if (parseMany(parseOp))
return addErrorSuffix(" in '" + Twine(IDVal) + "' directive");
return false;
return parseMany(parseOp);
}
/// parseDirectiveZero
@ -3310,9 +3302,9 @@ bool AsmParser::parseDirectiveOrg() {
int64_t FillExpr = 0;
if (parseOptionalToken(AsmToken::Comma))
if (parseAbsoluteExpression(FillExpr))
return addErrorSuffix(" in '.org' directive");
return true;
if (parseEOL())
return addErrorSuffix(" in '.org' directive");
return true;
getStreamer().emitValueToOffset(Offset, FillExpr, OffsetLoc);
return false;
@ -3349,14 +3341,14 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
};
if (checkForValidSection())
return addErrorSuffix(" in directive");
return true;
// Ignore empty '.p2align' directives for GNU-as compatibility
if (IsPow2 && (ValueSize == 1) && getTok().is(AsmToken::EndOfStatement)) {
Warning(AlignmentLoc, "p2align directive with no operand(s) is ignored");
return parseEOL();
}
if (parseAlign())
return addErrorSuffix(" in directive");
return true;
// Always emit an alignment here even if we thrown an error.
bool ReturnVal = false;
@ -4042,7 +4034,7 @@ bool AsmParser::parseDirectiveCVDefRange() {
bool AsmParser::parseDirectiveCVString() {
std::string Data;
if (checkForValidSection() || parseEscapedString(Data))
return addErrorSuffix(" in '.cv_string' directive");
return true;
// Put the string in the table and emit the offset.
std::pair<StringRef, unsigned> Insertion =
@ -4084,8 +4076,8 @@ bool AsmParser::parseDirectiveCVFPOData() {
StringRef ProcName;
if (parseIdentifier(ProcName))
return TokError("expected symbol name");
if (parseEOL("unexpected tokens"))
return addErrorSuffix(" in '.cv_fpo_data' directive");
if (parseEOL())
return true;
MCSymbol *ProcSym = getContext().getOrCreateSymbol(ProcName);
getStreamer().EmitCVFPOData(ProcSym, DirLoc);
return false;
@ -4124,7 +4116,7 @@ bool AsmParser::parseDirectiveCFIStartProc() {
if (check(parseIdentifier(Simple) || Simple != "simple",
"unexpected token") ||
parseEOL())
return addErrorSuffix(" in '.cfi_startproc' directive");
return true;
}
// TODO(kristina): Deal with a corner case of incorrect diagnostic context
@ -4140,7 +4132,7 @@ bool AsmParser::parseDirectiveCFIStartProc() {
/// ::= .cfi_endproc
bool AsmParser::parseDirectiveCFIEndProc() {
if (parseEOL())
return addErrorSuffix(" in '.cfi_endproc' directive");
return true;
getStreamer().emitCFIEndProc();
return false;
}
@ -4776,9 +4768,9 @@ bool AsmParser::parseDirectiveSpace(StringRef IDVal) {
int64_t FillExpr = 0;
if (parseOptionalToken(AsmToken::Comma))
if (parseAbsoluteExpression(FillExpr))
return addErrorSuffix("in '" + Twine(IDVal) + "' directive");
return true;
if (parseEOL())
return addErrorSuffix("in '" + Twine(IDVal) + "' directive");
return true;
// FIXME: Sometimes the fill expr is 'nop' if it isn't supplied, instead of 0.
getStreamer().emitFill(*NumBytes, FillExpr, NumBytesLoc);
@ -4889,10 +4881,7 @@ bool AsmParser::parseDirectiveLEB128(bool Signed) {
return false;
};
if (parseMany(parseOp))
return addErrorSuffix(" in directive");
return false;
return parseMany(parseOp);
}
/// parseDirectiveSymbolAttribute
@ -4918,9 +4907,7 @@ bool AsmParser::parseDirectiveSymbolAttribute(MCSymbolAttr Attr) {
return false;
};
if (parseMany(parseOp))
return addErrorSuffix(" in directive");
return false;
return parseMany(parseOp);
}
/// parseDirectiveComm
@ -5860,9 +5847,7 @@ bool AsmParser::parseDirectiveLTODiscard() {
};
LTODiscardSymbols.clear();
if (parseMany(ParseOp))
return addErrorSuffix(" in directive");
return false;
return parseMany(ParseOp);
}
// We are comparing pointers, but the pointers are relative to a single string.

View File

@ -3,155 +3,155 @@
// CHECK: [[#@LINE+1]]:19: error: expected newline
.equ ident1, 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.equ ident1, 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:19: error: expected newline
.equiv ident2, 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.equiv ident2, 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:19: error: expected newline
.set ident3, 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.set ident3, 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:20: error: unexpected token in '.ascii' directive
// CHECK: :[[#@LINE+1]]:20: error: unexpected token
.ascii "string1" $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.ascii "string1" // EOL COMMENT
// CHECK: [[@LINE+1]]:20: error: unexpected token in '.asciz' directive
// CHECK: :[[#@LINE+1]]:20: error: unexpected token
.asciz "string2" $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.asciz "string2" // EOL COMMENT
// CHECK: [[@LINE+1]]:20: error: unexpected token in '.string' directive
// CHECK: :[[#@LINE+1]]:20: error: unexpected token
.string "string3" $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.string "string3" // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.byte' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.byte 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.byte 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.b' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.dc.b 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.dc.b 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:8: error: unexpected token in '.dc' directive
// CHECK: :[[#@LINE+1]]:8: error: unexpected token
.dc 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.dc.b 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.w' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.dc.w 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.dc.w 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:11: error: unexpected token in '.short' directive
// CHECK: :[[#@LINE+1]]:11: error: unexpected token
.short 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.short 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:11: error: unexpected token in '.value' directive
// CHECK: :[[#@LINE+1]]:11: error: unexpected token
.value 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.value 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:11: error: unexpected token in '.2byte' directive
// CHECK: :[[#@LINE+1]]:11: error: unexpected token
.2byte 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.2byte 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.long' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.long 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.long 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.int' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.int 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.int 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:11: error: unexpected token in '.4byte' directive
// CHECK: :[[#@LINE+1]]:11: error: unexpected token
.4byte 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.4byte 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.l' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.dc.l 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.dc.l 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.quad' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.quad 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.quad 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:11: error: unexpected token in '.8byte' directive
// CHECK: :[[#@LINE+1]]:11: error: unexpected token
.8byte 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.8byte 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.a' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.dc.a 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.dc.a 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.octa' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.octa 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.octa 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:12: error: unexpected token in '.single' directive
// CHECK: :[[#@LINE+1]]:12: error: unexpected token
.single 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.single 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:11: error: unexpected token in '.float' directive
// CHECK: :[[#@LINE+1]]:11: error: unexpected token
.float 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.float 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.s' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.dc.s 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.dc.s 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:12: error: unexpected token in '.double' directive
// CHECK: :[[#@LINE+1]]:12: error: unexpected token
.double 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.double 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:10: error: unexpected token in '.dc.d' directive
// CHECK: :[[#@LINE+1]]:10: error: unexpected token
.dc.d 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.dc.d 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:13: error: expected newline
.fill 1, 1 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.fill 1, 1 // EOL COMMENT
// CHECK: [[#@LINE+1]]:17: error: expected newline
.fill 1, 1, 10 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.fill 1, 1, 10 // EOL COMMENT
// CHECK: [[#@LINE+1]]:16: error: expected newline
.org 1 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.org 1 // EOL COMMENT
// CHECK: [[#@LINE+1]]:11: error: expected newline
.align 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.align 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:13: error: expected newline
.align32 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.align32 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:12: error: expected newline
.balign 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.balign 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:13: error: expected newline
.balignw 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.balignw 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:13: error: expected newline
.balignl 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.balignl 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:13: error: expected newline
.p2align 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.p2align 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:14: error: expected newline
.p2alignw 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.p2alignw 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:14: error: expected newline
.p2alignl 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.p2alignl 0 // EOL COMMENT
// CHECK: [[#@LINE+1]]:8: error: expected newline
.line $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.line // EOL COMMENT
// CHECK: [[#@LINE+1]]:10: error: expected newline
.line 0 $
@ -159,20 +159,20 @@
.line 0 // EOL COMMENT
.file 1 "hello"
// CHECK: [[@LINE+1]]:16: error: unexpected token in '.loc' directive
// CHECK: :[[#@LINE+1]]:16: error: unexpected token
.loc 1 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.loc 1 // EOL COMMENT
// CHECK: [[@LINE+1]]:21: error: unexpected token in '.cv_file' directive
// CHECK: :[[#@LINE+1]]:21: error: unexpected token
.cv_file 1 "hello" $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.cv_file 1 "hello" // EOL COMMENT
.cv_func_id 1
// CHECK: [[@LINE+1]]:14: error: unexpected token in '.cv_loc' directive
// CHECK: :[[#@LINE+1]]:14: error: unexpected token
.cv_loc 1 1 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.cv_loc 1 1 // EOL COMMENT
// CHECK: [[#@LINE+1]]:28: error: expected newline
@ -180,62 +180,62 @@
// CHECK-NOT: [[#@LINE+1]]:{{[0-9]+}}: error:
.bundle_lock align_to_end // EOL COMMENT
// CHECK: [[@LINE+1]]:11: error: invalid token in expression in directive
// CHECK: [[#@LINE+1]]:11: error: invalid token in expression
.sleb128 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.sleb128 // EOL COMMENT
// CHECK: [[@LINE+1]]:13: error: unexpected token in directive
// CHECK: :[[#@LINE+1]]:13: error: unexpected token
.sleb128 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.sleb128 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:11: error: invalid token in expression in directive
// CHECK: :[[#@LINE+1]]:11: error: invalid token in expression
.uleb128 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.uleb128 // EOL COMMENT
// CHECK: [[@LINE+1]]:13: error: unexpected token in directive
// CHECK: :[[#@LINE+1]]:13: error: unexpected token
.uleb128 0 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.uleb128 0 // EOL COMMENT
// CHECK: [[@LINE+1]]:31: error: unexpected token
// CHECK: :[[#@LINE+1]]:31: error: unexpected token
.globl a1 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.globl a1 // EOL COMMENT
// CHECK: [[@LINE+1]]:31: error: unexpected token in directive
// CHECK: :[[#@LINE+1]]:31: error: unexpected token
.global a2 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.global a2 // EOL COMMENT
// CHECK: [[@LINE+1]]:31: error: unexpected token in directive
// CHECK: :[[#@LINE+1]]:31: error: unexpected token
.lazy_reference a3 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.lazy_reference a3 // EOL COMMENT
// CHECK: [[@LINE+1]]:31: error: unexpected token in directive
// CHECK: :[[#@LINE+1]]:31: error: unexpected token
.symbol_resolver a4 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.symbol_resolver a4 // EOL COMMENT
// CHECK: [[@LINE+1]]:31: error: unexpected token in directive
// CHECK: :[[#@LINE+1]]:31: error: unexpected token
.private_extern a5 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.private_extern a5 // EOL COMMENT
// CHECK: [[@LINE+1]]:31: error: unexpected token in directive
// CHECK: :[[#@LINE+1]]:31: error: unexpected token
.reference a6 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.reference a6 // EOL COMMENT
// CHECK: [[@LINE+1]]:31: error: unexpected token in directive
// CHECK: :[[#@LINE+1]]:31: error: unexpected token
.weak_definition a7 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.weak_definition a7 // EOL COMMENT
// CHECK: [[@LINE+1]]:31: error: unexpected token in directive
// CHECK: :[[#@LINE+1]]:31: error: unexpected token
.weak_reference a8 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.weak_reference a8 // EOL COMMENT
// CHECK: [[@LINE+1]]:31: error: unexpected token in directive
// CHECK: :[[#@LINE+1]]:31: error: unexpected token
.weak_def_can_be_hidden a9 $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.weak_def_can_be_hidden a9 // EOL COMMENT
// CHECK: [[@LINE+1]]:12: error: .warning argument must be a string
// CHECK: :[[#@LINE+1]]:12: error: .warning argument must be a string
.warning $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.warning // EOL COMMENT
// CHECK: [[#@LINE+1]]:21: error: expected newline
.warning "warning" $
@ -243,14 +243,14 @@
.warning "warning" // EOL COMMENT
// CHECK: [[@LINE+1]]:17: error: unexpected token in '.cfi_startproc' directive
// CHECK: :[[#@LINE+1]]:17: error: unexpected token
.cfi_startproc $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.cfi_startproc // EOL COMMENT
.cfi_endproc
// CHECK: [[#@LINE+1]]:24: error: expected newline
.cfi_startproc simple $
// CHECK-NOT: [[@LINE+1]]:{{[0-9]+}}: error:
// CHECK-NOT: :[[#@LINE+1]]:{{[0-9]+}}: error:
.cfi_startproc simple // EOL COMMENT
.cfi_endproc

View File

@ -4,7 +4,7 @@
.equ a, 0
.set a, 1
.equ a, 2
// CHECK: :[[#@LINE+1]]:11: error: redefinition of 'a'
.equiv a, 3
// CHECK: :[[#@LINE+1]]:12: error: missing expression
.set b, ""
// CHECK: error: redefinition of 'a'
// CHECK: error: missing expression in '.set' directive

View File

@ -1,17 +1,17 @@
// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s 2> %t.err | FileCheck %s
// RUN: FileCheck --check-prefix=CHECK-ERRORS %s < %t.err
// CHECK: .section __TEXT,__text,regular,pure_instructions
// CHECK-ERRORS: [[@LINE+1]]:10: error: invalid octal number in '.long' directive
// CHECK-ERRORS: :[[#@LINE+1]]:10: error: invalid octal number
.long 80+08
// CHECK-ERRORS: [[@LINE+1]]:10: error: invalid hexadecimal number in '.long' directive
// CHECK-ERRORS: :[[#@LINE+1]]:10: error: invalid hexadecimal number
.long 80+0xzz
// CHECK-ERRORS: [[@LINE+1]]:7: error: out of range literal value in '.byte' directive
// CHECK-ERRORS: :[[#@LINE+1]]:7: error: out of range literal value
.byte 256
// CHECK-ERRORS: [[@LINE+1]]:7: error: out of range literal value in '.long' directive
// CHECK-ERRORS: :[[#@LINE+1]]:7: error: out of range literal value
.long 4e71cf69 // double floating point constant due to missing "0x"
// CHECK-ERRORS: [[@LINE+1]]:7: error: out of range literal value in '.word' directive
// CHECK-ERRORS: :[[#@LINE+1]]:7: error: out of range literal value
.word 0xfffffffff

View File

@ -86,9 +86,9 @@
.double 1E-1
#CHECK-ERROR: unexpected token in '.double' directive
# CHECK-ERROR: :[[#@LINE+1]]:12: error: unexpected token
.double 1e1e
# CHECK-ERROR: Invalid sign in float literal
# CHECK-ERROR: :[[#@LINE+1]]:9: error: Invalid sign in float literal
.double 2.+1
# CHECK: .long 1310177520

View File

@ -3,45 +3,45 @@
.globl _foo
_foo:
.cv_fpo_proc
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: expected symbol name
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: expected symbol name
.cv_fpo_proc 1
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: expected symbol name
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: expected symbol name
.cv_fpo_proc _foo extra
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: expected parameter byte count
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: expected parameter byte count
.cv_fpo_proc _foo 4 extra
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: unexpected tokens in '.cv_fpo_proc' directive
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: unexpected tokens
.cv_fpo_proc _foo 4
pushl %ebp
.cv_fpo_pushreg 1
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: invalid register name in '.cv_fpo_pushreg' directive
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: invalid register name
.cv_fpo_pushreg ebp
subl $20, %esp
.cv_fpo_stackalloc asdf
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: expected offset in '.cv_fpo_stackalloc' directive
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: expected offset
.cv_fpo_stackalloc 20 asdf
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: unexpected tokens in '.cv_fpo_stackalloc' directive
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: unexpected tokens
.cv_fpo_stackalloc 20
.cv_fpo_endprologue asdf
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: unexpected tokens in '.cv_fpo_endprologue' directive
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: unexpected tokens
.cv_fpo_endprologue
addl $20, %esp
popl %ebp
retl
.cv_fpo_endproc asdf
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: unexpected tokens in '.cv_fpo_endproc' directive
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: unexpected tokens
.cv_fpo_endproc
.section .debug$S,"dr"
.p2align 2
.long 4 # Debug section magic
.cv_fpo_data
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: expected symbol name
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: expected symbol name
.cv_fpo_data 1
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: expected symbol name
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: expected symbol name
.cv_fpo_data _foo asdf
# CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: unexpected tokens in '.cv_fpo_data' directive
# CHECK: :[[#@LINE-1]]:{{[0-9]+}}: error: expected newline
.cv_fpo_data _foo
.long 0

View File

@ -451,11 +451,11 @@ f37:
// ERR: [[#@LINE+1]]:39: error: unexpected token
.cfi_sections .debug_frame, .eh_frame $
// ERR: [[#@LINE+1]]:16: error: unexpected token in '.cfi_startproc' directive
// ERR: [[#@LINE+1]]:16: error: unexpected token
.cfi_startproc $
// ERR: [[#@LINE+1]]:23: error: expected newline in '.cfi_startproc' directive
// ERR: [[#@LINE+1]]:23: error: expected newline
.cfi_startproc simple $
// ERR: [[#@LINE+1]]:14: error: expected newline in '.cfi_endproc' directive
// ERR: [[#@LINE+1]]:14: error: expected newline
.cfi_endproc $
.endif

View File

@ -25,6 +25,6 @@ bar:
.ifdef ERR
.text
# ERR: {{.*}}.s:[[#@LINE+1]]:14: error: expected identifier in directive
# ERR: {{.*}}.s:[[#@LINE+1]]:14: error: expected identifier
.lto_discard 1
.endif

View File

@ -1,20 +1,20 @@
# RUN: not llvm-mc -triple hexagon < %s 2>&1 | FileCheck %s
# CHECK: [[@LINE+1]]:7: error: out of range literal value in '.byte' directive
# CHECK: :[[#@LINE+1]]:7: error: out of range literal value
.byte 0xffa
# CHECK: [[@LINE+1]]:7: error: out of range literal value in '.half' directive
# CHECK: :[[#@LINE+1]]:7: error: out of range literal value
.half 0xffffa
# CHECK: [[@LINE+1]]:8: error: out of range literal value in '.short' directive
# CHECK: :[[#@LINE+1]]:8: error: out of range literal value
.short 0xffffa
# CHECK: [[@LINE+1]]:8: error: out of range literal value in '.hword' directive
# CHECK: :[[#@LINE+1]]:8: error: out of range literal value
.hword 0xffffa
# CHECK: [[@LINE+1]]:8: error: out of range literal value in '.2byte' directive
# CHECK: :[[#@LINE+1]]:8: error: out of range literal value
.2byte 0xffffa
# CHECK: [[@LINE+1]]:7: error: out of range literal value in '.word' directive
# CHECK: :[[#@LINE+1]]:7: error: out of range literal value
.word 0xffffffffa
# CHECK: [[@LINE+1]]:7: error: out of range literal value in '.long' directive
# CHECK: :[[#@LINE+1]]:7: error: out of range literal value
.long 0xffffffffa
# CHECK: [[@LINE+1]]:8: error: out of range literal value in '.4byte' directive
# CHECK: :[[#@LINE+1]]:8: error: out of range literal value
.4byte 0xffffffffa
# CHECK: [[@LINE+1]]:8: error: literal value out of range for directive in '.8byte' directive
# CHECK: :[[#@LINE+1]]:8: error: literal value out of range for directive
.8byte 0xffffffffffffffffa

View File

@ -1,8 +1,8 @@
# RUN: not llvm-mc -triple mips-unknown-linux %s 2>&1 | FileCheck %s
# CHECK: :[[#@LINE+1]]:11: error: expected string
.asciiz 12
# CHECK: :[[@LINE-1]]:11: error: expected string in '.asciiz' directive
# CHECK: :[[#@LINE+1]]:14: error: unexpected token
.asciiz "a"3
# CHECK: :[[@LINE-1]]:14: error: unexpected token in '.asciiz' directive
# CHECK: :[[#@LINE+1]]:15: error: expected string
.asciiz "a",
# CHECK: :[[@LINE-1]]:15: error: expected string in '.asciiz' directive

View File

@ -1,23 +1,23 @@
# RUN: not llvm-mc -triple riscv32 < %s 2>&1 | FileCheck %s
# RUN: not llvm-mc -triple riscv64 < %s 2>&1 | FileCheck %s
# CHECK: [[@LINE+1]]:7: error: out of range literal value in '.byte' directive
# CHECK: :[[#@LINE+1]]:7: error: out of range literal value
.byte 0xffa
# CHECK: [[@LINE+1]]:7: error: out of range literal value in '.half' directive
# CHECK: :[[#@LINE+1]]:7: error: out of range literal value
.half 0xffffa
# CHECK: [[@LINE+1]]:8: error: out of range literal value in '.short' directive
# CHECK: :[[#@LINE+1]]:8: error: out of range literal value
.short 0xffffa
# CHECK: [[@LINE+1]]:8: error: out of range literal value in '.hword' directive
# CHECK: :[[#@LINE+1]]:8: error: out of range literal value
.hword 0xffffa
# CHECK: [[@LINE+1]]:8: error: out of range literal value in '.2byte' directive
# CHECK: :[[#@LINE+1]]:8: error: out of range literal value
.2byte 0xffffa
# CHECK: [[@LINE+1]]:7: error: out of range literal value in '.word' directive
# CHECK: :[[#@LINE+1]]:7: error: out of range literal value
.word 0xffffffffa
# CHECK: [[@LINE+1]]:7: error: out of range literal value in '.long' directive
# CHECK: :[[#@LINE+1]]:7: error: out of range literal value
.long 0xffffffffa
# CHECK: [[@LINE+1]]:8: error: out of range literal value in '.4byte' directive
# CHECK: :[[#@LINE+1]]:8: error: out of range literal value
.4byte 0xffffffffa
# CHECK: [[@LINE+1]]:8: error: literal value out of range for directive in '.dword' directive
# CHECK: :[[#@LINE+1]]:8: error: literal value out of range for directive
.dword 0xffffffffffffffffa
# CHECK: [[@LINE+1]]:8: error: literal value out of range for directive in '.8byte' directive
# CHECK: :[[#@LINE+1]]:8: error: literal value out of range for directive
.8byte 0xffffffffffffffffa