Skip to content

Commit 88f094c

Browse files
vitalybukaAdvenamTacet
authored andcommitted
drop optional {}
1 parent 970dfd9 commit 88f094c

File tree

1 file changed

+19
-33
lines changed

1 file changed

+19
-33
lines changed

compiler-rt/lib/asan/asan_poisoning.cpp

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -601,17 +601,15 @@ static void SlowCopyContainerAnnotations(uptr src_beg, uptr src_end,
601601
uptr granule_end = granule_beg + granularity;
602602
uptr unpoisoned_bytes = 0;
603603

604-
for (; dst_ptr != granule_end && dst_ptr != dst_end; ++dst_ptr, ++src_ptr) {
604+
for (; dst_ptr != granule_end && dst_ptr != dst_end; ++dst_ptr, ++src_ptr)
605605
if (!AddressIsPoisoned(src_ptr))
606606
unpoisoned_bytes = dst_ptr - granule_beg + 1;
607-
}
608607
if (dst_ptr < dst_end || dst_ptr == dst_end_down ||
609608
AddressIsPoisoned(dst_end)) {
610-
if (unpoisoned_bytes != 0 || granule_beg >= dst_beg) {
609+
if (unpoisoned_bytes != 0 || granule_beg >= dst_beg)
611610
SetContainerGranule(granule_beg, unpoisoned_bytes);
612-
} else if (!AddressIsPoisoned(dst_beg)) {
611+
else if (!AddressIsPoisoned(dst_beg))
613612
SetContainerGranule(granule_beg, dst_beg - granule_beg);
614-
}
615613
}
616614
}
617615
}
@@ -631,21 +629,17 @@ static void SlowReversedCopyContainerAnnotations(uptr src_beg, uptr src_end,
631629
uptr granule_beg = RoundDownTo(dst_ptr - 1, granularity);
632630
uptr unpoisoned_bytes = 0;
633631

634-
for (; dst_ptr != granule_beg && dst_ptr != dst_beg; --dst_ptr, --src_ptr) {
635-
if (unpoisoned_bytes == 0 && !AddressIsPoisoned(src_ptr - 1)) {
632+
for (; dst_ptr != granule_beg && dst_ptr != dst_beg; --dst_ptr, --src_ptr)
633+
if (unpoisoned_bytes == 0 && !AddressIsPoisoned(src_ptr - 1))
636634
unpoisoned_bytes = dst_ptr - granule_beg;
637-
}
638-
}
639635

640-
if (dst_ptr >= dst_end_down && !AddressIsPoisoned(dst_end)) {
636+
if (dst_ptr >= dst_end_down && !AddressIsPoisoned(dst_end))
641637
continue;
642-
}
643638

644-
if (granule_beg == dst_ptr || unpoisoned_bytes != 0) {
639+
if (granule_beg == dst_ptr || unpoisoned_bytes != 0)
645640
SetContainerGranule(granule_beg, unpoisoned_bytes);
646-
} else if (!AddressIsPoisoned(dst_beg)) {
641+
else if (!AddressIsPoisoned(dst_beg))
647642
SetContainerGranule(granule_beg, dst_beg - granule_beg);
648-
}
649643
}
650644
}
651645

@@ -657,11 +651,10 @@ static void CopyContainerFirstGranuleAnnotation(uptr src_beg, uptr dst_beg) {
657651
// First granule
658652
uptr dst_beg_down = RoundDownTo(dst_beg, granularity);
659653
uptr src_beg_down = RoundDownTo(src_beg, granularity);
660-
if (!AddressIsPoisoned(src_beg)) {
654+
if (!AddressIsPoisoned(src_beg))
661655
*(u8 *)MemToShadow(dst_beg_down) = *(u8 *)MemToShadow(src_beg_down);
662-
} else if (!AddressIsPoisoned(dst_beg)) {
656+
else if (!AddressIsPoisoned(dst_beg))
663657
SetContainerGranule(dst_beg_down, dst_beg - dst_beg_down);
664-
}
665658
}
666659

667660
// A helper function for __sanitizer_copy_contiguous_container_annotations,
@@ -672,11 +665,10 @@ static void CopyContainerLastGranuleAnnotation(uptr src_end,
672665
constexpr uptr granularity = ASAN_SHADOW_GRANULARITY;
673666
// Last granule
674667
uptr src_end_down = RoundDownTo(src_end, granularity);
675-
if (AddressIsPoisoned(src_end)) {
668+
if (AddressIsPoisoned(src_end))
676669
*(u8 *)MemToShadow(dst_end_down) = *(u8 *)MemToShadow(src_end_down);
677-
} else {
670+
else
678671
SetContainerGranule(dst_end_down, src_end - src_end_down);
679-
}
680672
}
681673

682674
// This function copies ASan memory annotations (poisoned/unpoisoned states)
@@ -728,11 +720,10 @@ void __sanitizer_copy_contiguous_container_annotations(const void *src_beg_p,
728720
bool copy_in_reversed_order = src_beg < dst_beg && dst_beg <= src_end_up;
729721
if (src_beg % granularity != dst_beg % granularity ||
730722
RoundDownTo(dst_end - 1, granularity) <= dst_beg) {
731-
if (copy_in_reversed_order) {
723+
if (copy_in_reversed_order)
732724
SlowReversedCopyContainerAnnotations(src_beg, src_end, dst_beg, dst_end);
733-
} else {
725+
else
734726
SlowCopyContainerAnnotations(src_beg, src_end, dst_beg, dst_end);
735-
}
736727
return;
737728
}
738729

@@ -741,13 +732,11 @@ void __sanitizer_copy_contiguous_container_annotations(const void *src_beg_p,
741732
uptr dst_beg_up = RoundUpTo(dst_beg, granularity);
742733
uptr dst_end_down = RoundDownTo(dst_end, granularity);
743734
if (copy_in_reversed_order) {
744-
if (dst_end_down != dst_end && AddressIsPoisoned(dst_end)) {
735+
if (dst_end_down != dst_end && AddressIsPoisoned(dst_end))
745736
CopyContainerLastGranuleAnnotation(src_end, dst_end_down);
746-
}
747737
} else {
748-
if (dst_beg_up != dst_beg) {
738+
if (dst_beg_up != dst_beg)
749739
CopyContainerFirstGranuleAnnotation(src_beg, dst_beg);
750-
}
751740
}
752741

753742
if (dst_end_down > dst_beg_up) {
@@ -758,13 +747,10 @@ void __sanitizer_copy_contiguous_container_annotations(const void *src_beg_p,
758747
}
759748

760749
if (copy_in_reversed_order) {
761-
if (dst_beg_up != dst_beg) {
750+
if (dst_beg_up != dst_beg)
762751
CopyContainerFirstGranuleAnnotation(src_beg, dst_beg);
763-
}
764-
} else {
765-
if (dst_end_down != dst_end && AddressIsPoisoned(dst_end)) {
766-
CopyContainerLastGranuleAnnotation(src_end, dst_end_down);
767-
}
752+
} else if (dst_end_down != dst_end && AddressIsPoisoned(dst_end)) {
753+
CopyContainerLastGranuleAnnotation(src_end, dst_end_down);
768754
}
769755
}
770756

0 commit comments

Comments
 (0)