Skip to content

Commit c20596c

Browse files
authored
[NFC] [hwasan] also be more consistent when getting pointer types (#84399)
1 parent 66125ad commit c20596c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ class HWAddressSanitizer {
410410
ShadowMapping Mapping;
411411

412412
Type *VoidTy = Type::getVoidTy(M.getContext());
413-
Type *IntptrTy;
414-
PointerType *PtrTy;
413+
Type *IntptrTy = M.getDataLayout().getIntPtrType(M.getContext());
414+
PointerType *PtrTy = PointerType::getUnqual(M.getContext());
415415
Type *Int8Ty = Type::getInt8Ty(M.getContext());
416416
Type *Int32Ty = Type::getInt32Ty(M.getContext());
417417
Type *Int64Ty = Type::getInt64Ty(M.getContext());
@@ -594,8 +594,6 @@ void HWAddressSanitizer::createHwasanCtorComdat() {
594594
/// inserts a call to __hwasan_init to the module's constructor list.
595595
void HWAddressSanitizer::initializeModule() {
596596
LLVM_DEBUG(dbgs() << "Init " << M.getName() << "\n");
597-
auto &DL = M.getDataLayout();
598-
599597
TargetTriple = Triple(M.getTargetTriple());
600598

601599
// x86_64 currently has two modes:
@@ -613,8 +611,6 @@ void HWAddressSanitizer::initializeModule() {
613611

614612
C = &(M.getContext());
615613
IRBuilder<> IRB(*C);
616-
IntptrTy = IRB.getIntPtrTy(DL);
617-
PtrTy = IRB.getPtrTy();
618614

619615
HwasanCtorFunction = nullptr;
620616

0 commit comments

Comments
 (0)