Updated the enhanced disassembly library to produce

whitespace tokens in the right places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95645 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sean Callanan 2010-02-09 01:50:54 +00:00
parent c3c3be582d
commit 2d58147ca5

View File

@ -106,11 +106,28 @@ int EDToken::tokenize(std::vector<EDToken*> &tokens,
bool readOpcode = false; bool readOpcode = false;
const char *wsPointer = asmTokens.begin()->getLoc().getPointer();
for (tokenIterator = asmTokens.begin(); for (tokenIterator = asmTokens.begin();
tokenIterator != asmTokens.end(); tokenIterator != asmTokens.end();
++tokenIterator) { ++tokenIterator) {
SMLoc tokenLoc = tokenIterator->getLoc(); SMLoc tokenLoc = tokenIterator->getLoc();
const char *tokenPointer = tokenLoc.getPointer();
if(tokenPointer > wsPointer) {
unsigned long wsLength = tokenPointer - wsPointer;
EDToken *whitespaceToken = new EDToken(StringRef(wsPointer, wsLength),
EDToken::kTokenWhitespace,
0,
disassembler);
tokens.push_back(whitespaceToken);
}
wsPointer = tokenPointer + tokenIterator->getString().size();
while (operandIterator != parsedOperands.end() && while (operandIterator != parsedOperands.end() &&
tokenLoc.getPointer() > tokenLoc.getPointer() >
(*operandIterator)->getEndLoc().getPointer()) { (*operandIterator)->getEndLoc().getPointer()) {