[PATCH] D23458: Avoid accessing LLVM/DWARF register mappings if undefined
Dominic Chen via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 12 16:20:51 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL278574: Avoid accessing LLVM/DWARF register mappings if undefined (authored by ddcc).
Changed prior to commit:
https://reviews.llvm.org/D23458?vs=67866&id=67934#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23458
Files:
llvm/trunk/include/llvm/MC/MCRegisterInfo.h
llvm/trunk/lib/MC/MCRegisterInfo.cpp
Index: llvm/trunk/include/llvm/MC/MCRegisterInfo.h
===================================================================
--- llvm/trunk/include/llvm/MC/MCRegisterInfo.h
+++ llvm/trunk/include/llvm/MC/MCRegisterInfo.h
@@ -271,6 +271,16 @@
NumSubRegIndices = NumIndices;
SubRegIdxRanges = SubIdxRanges;
RegEncodingTable = RET;
+
+ // Initialize DWARF register mapping variables
+ EHL2DwarfRegs = nullptr;
+ EHL2DwarfRegsSize = 0;
+ L2DwarfRegs = nullptr;
+ L2DwarfRegsSize = 0;
+ EHDwarf2LRegs = nullptr;
+ EHDwarf2LRegsSize = 0;
+ Dwarf2LRegs = nullptr;
+ Dwarf2LRegsSize = 0;
}
/// \brief Used to initialize LLVM register to Dwarf
Index: llvm/trunk/lib/MC/MCRegisterInfo.cpp
===================================================================
--- llvm/trunk/lib/MC/MCRegisterInfo.cpp
+++ llvm/trunk/lib/MC/MCRegisterInfo.cpp
@@ -62,6 +62,8 @@
const DwarfLLVMRegPair *M = isEH ? EHL2DwarfRegs : L2DwarfRegs;
unsigned Size = isEH ? EHL2DwarfRegsSize : L2DwarfRegsSize;
+ if (!M)
+ return -1;
DwarfLLVMRegPair Key = { RegNum, 0 };
const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, Key);
if (I == M+Size || I->FromReg != RegNum)
@@ -73,6 +75,8 @@
const DwarfLLVMRegPair *M = isEH ? EHDwarf2LRegs : Dwarf2LRegs;
unsigned Size = isEH ? EHDwarf2LRegsSize : Dwarf2LRegsSize;
+ if (!M)
+ return -1;
DwarfLLVMRegPair Key = { RegNum, 0 };
const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, Key);
assert(I != M+Size && I->FromReg == RegNum && "Invalid RegNum");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23458.67934.patch
Type: text/x-patch
Size: 1551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160812/e1eeb823/attachment.bin>
More information about the llvm-commits
mailing list