This is an archive of the discontinued LLVM Phabricator instance.

Handle EOL preprocessor comments for ELFAsmParser symbol attr directives
Needs ReviewPublic

Authored by tejohnson on Mar 6 2017, 8:03 AM.

Details

Reviewers
pcc
espindola
Summary

There is already handling in the MCAsmParser for end-of-line comments
starting with "#". This is handled in MCAsmParser::parseOptionalToken,
which is invoked by MCAsmParser::parseMany which parses comma-separated
lists. However, the ELFAsmParser was not invoking this handling.

I found this issue when adding .global/.globl to the set of directives
handled by the ELFAsmParser for a different change, which caused the
test/MC/AsmParser/AArch64/directive-parse-err.s to fail to parse:

.global a2                   # EOL COMMENT

This is because the ELFAsmParser was then invoked to handle parsing
of this directive, instead of falling through to the invocation of
AsmParser::parseDirectiveSymbolAttribute (which invokes parseMany) in
AsmParser::parseStatement.

In this patch I add a test case to show the failure for a symbol
directive already processed by ELFAsmParser (.hidden), and modify
the parser to invoke parseMany.