OSDN Git Service

An MCDisassembler has the option to not implement
authorShantonu Sen <ssen@apple.com>
Tue, 5 Apr 2011 18:40:45 +0000 (18:40 +0000)
committerShantonu Sen <ssen@apple.com>
Tue, 5 Apr 2011 18:40:45 +0000 (18:40 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128904 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCDisassembler/EDDisassembler.cpp

index f679647..e36b3a4 100644 (file)
@@ -254,9 +254,11 @@ EDInst *EDDisassembler::createInst(EDByteReaderCallback byteReader,
     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;