[PATCH] D14252: [AsmParser] Allow tokens to be put back in to the token stream.
Colin LeMahieu via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 5 12:04:25 PST 2015
colinl added a comment.
Although a datastructure like a deque or a ring buffer would more directly represent what we're trying to do, a SmallVector was chosen because some backends do the following sequence:
AsmToken const &Token = Lexer.getTok();
useToken(Token);
Lexer.Lex();
useToken(Token);
Since the number of tokens in the buffer is going to be small, usually 1, a SmallVector with pushing to head should be fine.
There should be no functional change.
I noticed some backends have copy/pasted the built in expression parser for similar reasons as above, they could possibly make use of this change.
Repository:
rL LLVM
http://reviews.llvm.org/D14252
More information about the llvm-commits
mailing list