[llvm-commits] [llvm] r138963 - in /llvm/trunk/lib/MC/MCDisassembler: Disassembler.cpp EDDisassembler.cpp
Nick Lewycky
nicholas at mxc.ca
Thu Sep 1 14:09:04 PDT 2011
Author: nicholas
Date: Thu Sep 1 16:09:04 2011
New Revision: 138963
URL: http://llvm.org/viewvc/llvm-project?rev=138963&view=rev
Log:
Fix the build for us -Werror users.
Remove broken emacs mode major notation marking a C++ file as C.
No functionality change.
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=138963&r1=138962&r2=138963&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp (original)
+++ llvm/trunk/lib/MC/MCDisassembler/Disassembler.cpp Thu Sep 1 16:09:04 2011
@@ -1,4 +1,4 @@
-//===-- lib/MC/Disassembler.cpp - Disassembler Public C Interface -*- C -*-===//
+//===-- lib/MC/Disassembler.cpp - Disassembler Public C Interface ---------===//
//
// The LLVM Compiler Infrastructure
//
@@ -135,25 +135,21 @@
MCInst Inst;
const MCDisassembler *DisAsm = DC->getDisAsm();
MCInstPrinter *IP = DC->getIP();
- MCDisassembler::DecodeStatus S;
- S = DisAsm->getInstruction(Inst, Size, MemoryObject, PC, /*REMOVE*/ nulls());
- switch (S) {
- case MCDisassembler::Fail:
- case MCDisassembler::SoftFail:
+ if (DisAsm->getInstruction(Inst, Size, MemoryObject, PC,
+ /*REMOVE*/ nulls()) != MCDisassembler::Success) {
// FIXME: Do something different for soft failure modes?
return 0;
- 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.
-
- return Size;
- }
}
+
+ 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.
+
+ return Size;
}
Modified: llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp?rev=138963&r1=138962&r2=138963&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp (original)
+++ llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp Thu Sep 1 16:09:04 2011
@@ -239,29 +239,20 @@
MCInst* inst = new MCInst;
uint64_t byteSize;
- MCDisassembler::DecodeStatus S;
- S = Disassembler->getInstruction(*inst,
- byteSize,
- memoryObject,
- address,
- ErrorStream);
- switch (S) {
- case MCDisassembler::Fail:
- case MCDisassembler::SoftFail:
+ if (Disassembler->getInstruction(*inst, byteSize, memoryObject, address,
+ ErrorStream) != MCDisassembler::Success) {
// FIXME: Do something different on soft failure mode?
delete inst;
return NULL;
- case MCDisassembler::Success: {
- const llvm::EDInstInfo *thisInstInfo = NULL;
-
- if (InstInfos) {
- thisInstInfo = &InstInfos[inst->getOpcode()];
- }
-
- EDInst* sdInst = new EDInst(inst, byteSize, *this, thisInstInfo);
- return sdInst;
}
+ const llvm::EDInstInfo *thisInstInfo = NULL;
+
+ if (InstInfos) {
+ thisInstInfo = &InstInfos[inst->getOpcode()];
}
+
+ EDInst* sdInst = new EDInst(inst, byteSize, *this, thisInstInfo);
+ return sdInst;
}
void EDDisassembler::initMaps(const MCRegisterInfo ®isterInfo) {
More information about the llvm-commits
mailing list