[Asm] Don't list '@<type>' in diag when '@' is a comment

This fixes https://bugs.llvm.org//show_bug.cgi?id=31280

Differential revision: https://reviews.llvm.org/D31026

llvm-svn: 298067
This commit is contained in:
Oliver Stannard 2017-03-17 11:10:17 +00:00
parent b7f0f45ffe
commit 8761e9bb43
2 changed files with 10 additions and 2 deletions

View File

@ -391,8 +391,12 @@ bool ELFAsmParser::maybeParseSectionType(StringRef &TypeName) {
return false;
Lex();
if (L.isNot(AsmToken::At) && L.isNot(AsmToken::Percent) &&
L.isNot(AsmToken::String))
return TokError("expected '@<type>', '%<type>' or \"<type>\"");
L.isNot(AsmToken::String)) {
if (L.getAllowAtInIdentifier())
return TokError("expected '@<type>', '%<type>' or \"<type>\"");
else
return TokError("expected '%<type>' or \"<type>\"");
}
if (!L.is(AsmToken::String))
Lex();
if (L.is(AsmToken::Integer)) {

View File

@ -7,3 +7,7 @@
// CHECK: .type TYPE #32
// CHECK: ^
// For ARM, the comment character is '@', so we don't list '@<type>' as a
// valid option.
.section "foo", "a", @progbits
// CHECK: error: expected '%<type>' or "<type>"