[llvm-commits] [llvm] r138973 - in /llvm/trunk/lib/MC/MCDisassembler: Disassembler.cpp EDDisassembler.cpp
James Molloy
james.molloy at arm.com
Thu Sep 1 15:01:14 PDT 2011
Author: jamesm
Date: Thu Sep 1 17:01:14 2011
New Revision: 138973
URL: http://llvm.org/viewvc/llvm-project?rev=138973&view=rev
Log:
Fix apparent build error caused by r138948 on certain versions of GCC with -Werror. Sorry for the inconvenience.
Modified:
llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp
llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp
Modified: llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp?rev=138973&r1=138972&r2=138973&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp (original)
+++ llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp Thu Sep 1 17:01:14 2011
@@ -135,21 +135,28 @@
MCInst Inst;
const MCDisassembler *DisAsm = DC->getDisAsm();
MCInstPrinter *IP = DC->getIP();
- if (DisAsm->getInstruction(Inst, Size, MemoryObject, PC,
- /*REMOVE*/ nulls()) != MCDisassembler::Success) {
+ MCDisassembler::DecodeStatus S;
+ S = DisAsm->getInstruction(Inst, Size, MemoryObject, PC,
+ /*REMOVE*/ nulls());
+ switch (S) {
+ case MCDisassembler::Fail:
+ case MCDisassembler::SoftFail:
// FIXME: Do something different for soft failure modes?
return 0;
- }
- SmallVector<char, 64> InsnStr;
- raw_svector_ostream OS(InsnStr);
- IP->printInst(&Inst, OS);
- OS.flush();
+ case MCDisassembler::Success: {
+ SmallVector<char, 64> InsnStr;
+ raw_svector_ostream OS(InsnStr);
+ IP->printInst(&Inst, OS);
+ OS.flush();
- assert(OutStringSize != 0 && "Output buffer cannot be zero size");
- size_t OutputSize = std::min(OutStringSize-1, InsnStr.size());
- std::memcpy(OutString, InsnStr.data(), OutputSize);
- OutString[OutputSize] = '\0'; // Terminate string.
+ assert(OutStringSize != 0 && "Output buffer cannot be zero size");
+ size_t OutputSize = std::min(OutStringSize-1, InsnStr.size());
+ std::memcpy(OutString, InsnStr.data(), OutputSize);
+ OutString[OutputSize] = '\0'; // Terminate string.
- return Size;
+ return Size;
+ }
+ }
+ return 0;
}
Modified: llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp?rev=138973&r1=138972&r2=138973&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp (original)
+++ llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp Thu Sep 1 17:01:14 2011
@@ -239,20 +239,28 @@
MCInst* inst = new MCInst;
uint64_t byteSize;
- if (Disassembler->getInstruction(*inst, byteSize, memoryObject, address,
- ErrorStream) != MCDisassembler::Success) {
+ MCDisassembler::DecodeStatus S;
+ S = Disassembler->getInstruction(*inst, byteSize, memoryObject, address,
+ ErrorStream);
+ switch (S) {
+ case MCDisassembler::Fail:
+ case MCDisassembler::SoftFail:
// FIXME: Do something different on soft failure mode?
delete inst;
return NULL;
- }
- const llvm::EDInstInfo *thisInstInfo = NULL;
+
+ case MCDisassembler::Success: {
+ const llvm::EDInstInfo *thisInstInfo = NULL;
- if (InstInfos) {
- thisInstInfo = &InstInfos[inst->getOpcode()];
- }
+ if (InstInfos) {
+ thisInstInfo = &InstInfos[inst->getOpcode()];
+ }
- EDInst* sdInst = new EDInst(inst, byteSize, *this, thisInstInfo);
- return sdInst;
+ EDInst* sdInst = new EDInst(inst, byteSize, *this, thisInstInfo);
+ return sdInst;
+ }
+ }
+ return NULL;
}
void EDDisassembler::initMaps(const MCRegisterInfo ®isterInfo) {
More information about the llvm-commits
mailing list