@@ -161,29 +161,29 @@ void TypeSanitizer::initializeCallbacks(Module &M) {
161161 TysanCtorFunction =
162162 M.getOrInsertFunction (kTysanModuleCtorName , Attr, IRB.getVoidTy ());
163163
164- TysanIntrumentMemInst =
165- M. getOrInsertFunction ( " __tysan_instrument_mem_inst" , Attr, IRB.getVoidTy (),
166- IRB.getPtrTy (), // Pointer of data to be written to
167- IRB.getPtrTy (), // Pointer of data to write
168- U64Ty, // Size of the data in bytes
169- BoolType // Do we need to call memmove
170- );
171-
172- TysanInstrumentWithShadowUpdate =
173- M. getOrInsertFunction ( " __tysan_instrument_with_shadow_update" , Attr, IRB.getVoidTy (),
174- IRB.getPtrTy (), // Pointer to data to be read
175- IRB.getPtrTy (), // Pointer to type descriptor
176- BoolType, // Do we need to type check this
177- U64Ty, // Size of data we access in bytes
178- OrdTy // Flags
179- );
180-
181- TysanSetShadowType =
182- M. getOrInsertFunction ( " __tysan_set_shadow_type" , Attr, IRB.getVoidTy (),
183- IRB.getPtrTy (), // Pointer of data to be written to
184- IRB.getPtrTy (), // Pointer to the new type descriptor
185- U64Ty // Size of data we access in bytes
186- );
164+ TysanIntrumentMemInst = M. getOrInsertFunction (
165+ " __tysan_instrument_mem_inst" , Attr, IRB.getVoidTy (),
166+ IRB.getPtrTy (), // Pointer of data to be written to
167+ IRB.getPtrTy (), // Pointer of data to write
168+ U64Ty, // Size of the data in bytes
169+ BoolType // Do we need to call memmove
170+ );
171+
172+ TysanInstrumentWithShadowUpdate = M. getOrInsertFunction (
173+ " __tysan_instrument_with_shadow_update" , Attr, IRB.getVoidTy (),
174+ IRB.getPtrTy (), // Pointer to data to be read
175+ IRB.getPtrTy (), // Pointer to type descriptor
176+ BoolType, // Do we need to type check this
177+ U64Ty, // Size of data we access in bytes
178+ OrdTy // Flags
179+ );
180+
181+ TysanSetShadowType = M. getOrInsertFunction (
182+ " __tysan_set_shadow_type" , Attr, IRB.getVoidTy (),
183+ IRB.getPtrTy (), // Pointer of data to be written to
184+ IRB.getPtrTy (), // Pointer to the new type descriptor
185+ U64Ty // Size of data we access in bytes
186+ );
187187}
188188
189189void TypeSanitizer::instrumentGlobals (Module &M) {
@@ -627,7 +627,7 @@ bool TypeSanitizer::instrumentWithShadowUpdate(
627627
628628 Value *TD = IRB.CreateBitCast (TDGV, IRB.getPtrTy ());
629629
630- if (ClOutlineInstrumentation){
630+ if (ClOutlineInstrumentation) {
631631 if (!ForceSetType && (!ClWritesAlwaysSetType || IsRead)) {
632632 // We need to check the type here. If the type is unknown, then the read
633633 // sets the type. If the type is known, then it is checked. If the type
@@ -638,7 +638,8 @@ bool TypeSanitizer::instrumentWithShadowUpdate(
638638 ConstantInt::get (OrdTy, (int )IsRead | (((int )IsWrite) << 1 ));
639639
640640 IRB.CreateCall (TysanInstrumentWithShadowUpdate,
641- {Ptr, TD, SanitizeFunction ? IRB.getTrue () : IRB.getFalse (),
641+ {Ptr, TD,
642+ SanitizeFunction ? IRB.getTrue () : IRB.getFalse (),
642643 IRB.getInt64 (AccessSize), Flags});
643644 } else if (ForceSetType || IsWrite) {
644645 // In the mode where writes always set the type, for a write (which does
@@ -893,14 +894,13 @@ bool TypeSanitizer::instrumentMemInst(Value *V, Instruction *ShadowBase,
893894 }
894895
895896 if (ClOutlineInstrumentation) {
896- if (!Src){
897+ if (!Src) {
897898 Src = ConstantPointerNull::get (IRB.getPtrTy ());
898899 }
899- IRB.CreateCall (TysanIntrumentMemInst, {
900- Dest, Src, Size, NeedsMemMove ? IRB.getTrue () : IRB.getFalse ()
901- });
902- }
903- else {
900+ IRB.CreateCall (
901+ TysanIntrumentMemInst,
902+ {Dest, Src, Size, NeedsMemMove ? IRB.getTrue () : IRB.getFalse ()});
903+ } else {
904904 if (!ShadowBase)
905905 ShadowBase = getShadowBase (*F);
906906 if (!AppMemMask)
@@ -914,8 +914,8 @@ bool TypeSanitizer::instrumentMemInst(Value *V, Instruction *ShadowBase,
914914 Value *ShadowData = IRB.CreateIntToPtr (ShadowDataInt, IRB.getPtrTy ());
915915
916916 if (!Src) {
917- IRB.CreateMemSet (ShadowData, IRB.getInt8 (0 ), IRB. CreateShl (Size, PtrShift),
918- Align (1ull << PtrShift));
917+ IRB.CreateMemSet (ShadowData, IRB.getInt8 (0 ),
918+ IRB. CreateShl (Size, PtrShift), Align (1ull << PtrShift));
919919 return true ;
920920 }
921921
@@ -931,7 +931,7 @@ bool TypeSanitizer::instrumentMemInst(Value *V, Instruction *ShadowBase,
931931 Align (1ull << PtrShift), IRB.CreateShl (Size, PtrShift));
932932 } else {
933933 IRB.CreateMemCpy (ShadowData, Align (1ull << PtrShift), SrcShadowData,
934- Align (1ull << PtrShift), IRB.CreateShl (Size, PtrShift));
934+ Align (1ull << PtrShift), IRB.CreateShl (Size, PtrShift));
935935 }
936936 }
937937
0 commit comments