[MC] Prevent out of order HashDirective lexing in AsmLexer.
authorNirav Dave <niravd@google.com>
Sat, 1 Oct 2016 00:42:32 +0000 (00:42 +0000)
committerNirav Dave <niravd@google.com>
Sat, 1 Oct 2016 00:42:32 +0000 (00:42 +0000)
commit9f2bd4e7eacccd5e29747f38ac033562fd85bd5e
tree9e3d002dc4f68c8d137666131bde22a82f8a22db
parentc0657a6ceb3c617ca37ec2eb716475cf4348e0c6
[MC] Prevent out of order HashDirective lexing in AsmLexer.

To lex hash directives we peek ahead to find component tokens, create a
unified token, and unlex the peeked tokens so the parser does not need
to parse the tokens then. Make sure we do not to lex another hash
directive during peek operation.

This fixes PR28921.

Reviewers: rnk, loladiro

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24839

llvm-svn: 282992
llvm/include/llvm/MC/MCParser/AsmLexer.h
llvm/lib/MC/MCParser/AsmLexer.cpp
llvm/test/MC/AsmParser/pr28921.s [new file with mode: 0644]