@@ -62,7 +62,7 @@ class CGBuilderTy : public CGBuilderBaseTy {
62
62
template <bool IsInBounds>
63
63
Address createConstGEP2_32 (Address Addr, unsigned Idx0, unsigned Idx1,
64
64
const llvm::Twine &Name) {
65
- const llvm::DataLayout &DL = BB->getParent ()-> getParent ()-> getDataLayout ();
65
+ const llvm::DataLayout &DL = BB->getDataLayout ();
66
66
llvm::GetElementPtrInst *GEP;
67
67
if (IsInBounds)
68
68
GEP = cast<llvm::GetElementPtrInst>(CreateConstInBoundsGEP2_32 (
@@ -218,7 +218,7 @@ class CGBuilderTy : public CGBuilderBaseTy {
218
218
Address CreateStructGEP (Address Addr, unsigned Index,
219
219
const llvm::Twine &Name = " " ) {
220
220
llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType ());
221
- const llvm::DataLayout &DL = BB->getParent ()-> getParent ()-> getDataLayout ();
221
+ const llvm::DataLayout &DL = BB->getDataLayout ();
222
222
const llvm::StructLayout *Layout = DL.getStructLayout (ElTy);
223
223
auto Offset = CharUnits::fromQuantity (Layout->getElementOffset (Index));
224
224
@@ -240,7 +240,7 @@ class CGBuilderTy : public CGBuilderBaseTy {
240
240
Address CreateConstArrayGEP (Address Addr, uint64_t Index,
241
241
const llvm::Twine &Name = " " ) {
242
242
llvm::ArrayType *ElTy = cast<llvm::ArrayType>(Addr.getElementType ());
243
- const llvm::DataLayout &DL = BB->getParent ()-> getParent ()-> getDataLayout ();
243
+ const llvm::DataLayout &DL = BB->getDataLayout ();
244
244
CharUnits EltSize =
245
245
CharUnits::fromQuantity (DL.getTypeAllocSize (ElTy->getElementType ()));
246
246
@@ -260,7 +260,7 @@ class CGBuilderTy : public CGBuilderBaseTy {
260
260
Address CreateConstInBoundsGEP (Address Addr, uint64_t Index,
261
261
const llvm::Twine &Name = " " ) {
262
262
llvm::Type *ElTy = Addr.getElementType ();
263
- const llvm::DataLayout &DL = BB->getParent ()-> getParent ()-> getDataLayout ();
263
+ const llvm::DataLayout &DL = BB->getDataLayout ();
264
264
CharUnits EltSize = CharUnits::fromQuantity (DL.getTypeAllocSize (ElTy));
265
265
266
266
return Address (
@@ -277,7 +277,7 @@ class CGBuilderTy : public CGBuilderBaseTy {
277
277
Address CreateConstGEP (Address Addr, uint64_t Index,
278
278
const llvm::Twine &Name = " " ) {
279
279
llvm::Type *ElTy = Addr.getElementType ();
280
- const llvm::DataLayout &DL = BB->getParent ()-> getParent ()-> getDataLayout ();
280
+ const llvm::DataLayout &DL = BB->getDataLayout ();
281
281
CharUnits EltSize = CharUnits::fromQuantity (DL.getTypeAllocSize (ElTy));
282
282
283
283
return Address (CreateGEP (ElTy, Addr.getBasePointer (), getSize (Index), Name),
@@ -290,7 +290,7 @@ class CGBuilderTy : public CGBuilderBaseTy {
290
290
using CGBuilderBaseTy::CreateGEP;
291
291
Address CreateGEP (CodeGenFunction &CGF, Address Addr, llvm::Value *Index,
292
292
const llvm::Twine &Name = " " ) {
293
- const llvm::DataLayout &DL = BB->getParent ()-> getParent ()-> getDataLayout ();
293
+ const llvm::DataLayout &DL = BB->getDataLayout ();
294
294
CharUnits EltSize =
295
295
CharUnits::fromQuantity (DL.getTypeAllocSize (Addr.getElementType ()));
296
296
@@ -412,7 +412,7 @@ class CGBuilderTy : public CGBuilderBaseTy {
412
412
unsigned FieldIndex,
413
413
llvm::MDNode *DbgInfo) {
414
414
llvm::StructType *ElTy = cast<llvm::StructType>(Addr.getElementType ());
415
- const llvm::DataLayout &DL = BB->getParent ()-> getParent ()-> getDataLayout ();
415
+ const llvm::DataLayout &DL = BB->getDataLayout ();
416
416
const llvm::StructLayout *Layout = DL.getStructLayout (ElTy);
417
417
auto Offset = CharUnits::fromQuantity (Layout->getElementOffset (Index));
418
418
0 commit comments