@@ -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) {
@@ -629,7 +629,7 @@ bool TypeSanitizer::instrumentWithShadowUpdate(
629629
630630 Value *TD = IRB.CreateBitCast (TDGV, IRB.getPtrTy ());
631631
632- if (ClOutlineInstrumentation){
632+ if (ClOutlineInstrumentation) {
633633 if (!ForceSetType && (!ClWritesAlwaysSetType || IsRead)) {
634634 // We need to check the type here. If the type is unknown, then the read
635635 // sets the type. If the type is known, then it is checked. If the type
@@ -640,7 +640,8 @@ bool TypeSanitizer::instrumentWithShadowUpdate(
640640 ConstantInt::get (OrdTy, (int )IsRead | (((int )IsWrite) << 1 ));
641641
642642 IRB.CreateCall (TysanInstrumentWithShadowUpdate,
643- {Ptr, TD, SanitizeFunction ? IRB.getTrue () : IRB.getFalse (),
643+ {Ptr, TD,
644+ SanitizeFunction ? IRB.getTrue () : IRB.getFalse (),
644645 IRB.getInt64 (AccessSize), Flags});
645646 } else if (ForceSetType || IsWrite) {
646647 // In the mode where writes always set the type, for a write (which does
@@ -899,14 +900,13 @@ bool TypeSanitizer::instrumentMemInst(Value *V, Instruction *ShadowBase,
899900 }
900901
901902 if (ClOutlineInstrumentation) {
902- if (!Src){
903+ if (!Src) {
903904 Src = ConstantPointerNull::get (IRB.getPtrTy ());
904905 }
905- IRB.CreateCall (TysanIntrumentMemInst, {
906- Dest, Src, Size, NeedsMemMove ? IRB.getTrue () : IRB.getFalse ()
907- });
908- }
909- else {
906+ IRB.CreateCall (
907+ TysanIntrumentMemInst,
908+ {Dest, Src, Size, NeedsMemMove ? IRB.getTrue () : IRB.getFalse ()});
909+ } else {
910910 if (!ShadowBase)
911911 ShadowBase = getShadowBase (*F);
912912 if (!AppMemMask)
@@ -920,8 +920,8 @@ bool TypeSanitizer::instrumentMemInst(Value *V, Instruction *ShadowBase,
920920 Value *ShadowData = IRB.CreateIntToPtr (ShadowDataInt, IRB.getPtrTy ());
921921
922922 if (!Src) {
923- IRB.CreateMemSet (ShadowData, IRB.getInt8 (0 ), IRB. CreateShl (Size, PtrShift),
924- Align (1ull << PtrShift));
923+ IRB.CreateMemSet (ShadowData, IRB.getInt8 (0 ),
924+ IRB. CreateShl (Size, PtrShift), Align (1ull << PtrShift));
925925 return true ;
926926 }
927927
@@ -937,7 +937,7 @@ bool TypeSanitizer::instrumentMemInst(Value *V, Instruction *ShadowBase,
937937 Align (1ull << PtrShift), IRB.CreateShl (Size, PtrShift));
938938 } else {
939939 IRB.CreateMemCpy (ShadowData, Align (1ull << PtrShift), SrcShadowData,
940- Align (1ull << PtrShift), IRB.CreateShl (Size, PtrShift));
940+ Align (1ull << PtrShift), IRB.CreateShl (Size, PtrShift));
941941 }
942942 }
943943
0 commit comments