[llvm-commits] [llvm] r128904 - /llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp

Shantonu Sen ssen at apple.com
Tue Apr 5 11:40:45 PDT 2011


Author: ssen
Date: Tue Apr  5 13:40:45 2011
New Revision: 128904

URL: http://llvm.org/viewvc/llvm-project?rev=128904&view=rev
Log:
An MCDisassembler has the option to not implement
getEDInfo(), in which case this code would dereference
NULL. EDInst can already handle NULL info, so avoid
the dereference and pass NULL through.

Reviewed by Sean Callanan

Modified:
    llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp

Modified: llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp?rev=128904&r1=128903&r2=128904&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp (original)
+++ llvm/trunk/lib/MC/MCDisassembler/EDDisassembler.cpp Tue Apr  5 13:40:45 2011
@@ -254,9 +254,11 @@
     delete inst;
     return NULL;
   } else {
-    const llvm::EDInstInfo *thisInstInfo;
+    const llvm::EDInstInfo *thisInstInfo = NULL;
 
-    thisInstInfo = &InstInfos[inst->getOpcode()];
+    if (InstInfos) {
+      thisInstInfo = &InstInfos[inst->getOpcode()];
+    }
     
     EDInst* sdInst = new EDInst(inst, byteSize, *this, thisInstInfo);
     return sdInst;





More information about the llvm-commits mailing list