diff options
author | Sean Callanan <scallanan@apple.com> | 2010-02-09 01:50:54 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2010-02-09 01:50:54 +0000 |
commit | 18963d38c91f46a1d33a541dc3f992ed52ec3bbb (patch) | |
tree | 4cfe253bc2f8160f7e23b9d50d218e49f4f500d0 /tools | |
parent | 8633f90bafad3299a57ec1a68df9361be76b0c0d (diff) | |
download | external_llvm-18963d38c91f46a1d33a541dc3f992ed52ec3bbb.zip external_llvm-18963d38c91f46a1d33a541dc3f992ed52ec3bbb.tar.gz external_llvm-18963d38c91f46a1d33a541dc3f992ed52ec3bbb.tar.bz2 |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/edis/EDToken.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/edis/EDToken.cpp b/tools/edis/EDToken.cpp index 9408305..cd79152 100644 --- a/tools/edis/EDToken.cpp +++ b/tools/edis/EDToken.cpp @@ -106,11 +106,28 @@ int EDToken::tokenize(std::vector<EDToken*> &tokens, bool readOpcode = false; + const char *wsPointer = asmTokens.begin()->getLoc().getPointer(); + for (tokenIterator = asmTokens.begin(); tokenIterator != asmTokens.end(); ++tokenIterator) { 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() && tokenLoc.getPointer() > (*operandIterator)->getEndLoc().getPointer()) { |