[llvm-commits] [llvm] r95639 - /llvm/trunk/tools/edis/EDToken.cpp
Sean Callanan
scallanan at apple.com
Mon Feb 8 17:00:18 PST 2010
Author: spyffe
Date: Mon Feb 8 19:00:18 2010
New Revision: 95639
URL: http://llvm.org/viewvc/llvm-project?rev=95639&view=rev
Log:
Fixed a problem where the enhanced disassembly
library was reporting inaccurate token IDs.
Modified:
llvm/trunk/tools/edis/EDToken.cpp
Modified: llvm/trunk/tools/edis/EDToken.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/edis/EDToken.cpp?rev=95639&r1=95638&r2=95639&view=diff
==============================================================================
--- llvm/trunk/tools/edis/EDToken.cpp (original)
+++ llvm/trunk/tools/edis/EDToken.cpp Mon Feb 8 19:00:18 2010
@@ -94,7 +94,8 @@
SmallVector<MCParsedAsmOperand*, 5> parsedOperands;
SmallVector<AsmToken, 10> asmTokens;
- disassembler.parseInst(parsedOperands, asmTokens, str);
+ if(disassembler.parseInst(parsedOperands, asmTokens, str))
+ return -1;
SmallVectorImpl<MCParsedAsmOperand*>::iterator operandIterator;
unsigned int operandIndex;
@@ -167,7 +168,12 @@
if(operandIterator != parsedOperands.end() &&
tokenLoc.getPointer() >=
(*operandIterator)->getStartLoc().getPointer()) {
- token->setOperandID(operandOrder[operandIndex]);
+ /// operandIndex == 0 means the operand is the instruction (which the
+ /// AsmParser treats as an operand but edis does not). We therefore skip
+ /// operandIndex == 0 and subtract 1 from all other operand indices.
+
+ if(operandIndex > 0)
+ token->setOperandID(operandOrder[operandIndex - 1]);
}
tokens.push_back(token);
More information about the llvm-commits
mailing list