Skip to content

Commit adb476b

Browse files
vitalybukaKamil Kashapov
andauthored
[nfc][msan] Clang-format MemorySanitizer.cpp (#115828)
Extracted from #109284 Co-authored-by: Kamil Kashapov <[email protected]>
1 parent f77101e commit adb476b

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
/// We associate a few shadow bits with every byte of the application memory,
1616
/// poison the shadow of the malloc-ed or alloca-ed memory, load the shadow,
1717
/// bits on every memory read, propagate the shadow bits through some of the
18-
/// arithmetic instruction (including MOV), store the shadow bits on every memory
19-
/// write, report a bug on some other instructions (e.g. JMP) if the
18+
/// arithmetic instruction (including MOV), store the shadow bits on every
19+
/// memory write, report a bug on some other instructions (e.g. JMP) if the
2020
/// associated shadow is poisoned.
2121
///
2222
/// But there are differences too. The first and the major one:
@@ -579,7 +579,7 @@ class MemorySanitizer {
579579

580580
Triple TargetTriple;
581581
LLVMContext *C;
582-
Type *IntptrTy; ///< Integer type with the size of a ptr in default AS.
582+
Type *IntptrTy; ///< Integer type with the size of a ptr in default AS.
583583
Type *OriginTy;
584584
PointerType *PtrTy; ///< Integer type with the size of a ptr in default AS.
585585

@@ -840,7 +840,8 @@ static Constant *getOrInsertGlobal(Module &M, StringRef Name, Type *Ty) {
840840
}
841841

842842
/// Insert declarations for userspace-specific functions and globals.
843-
void MemorySanitizer::createUserspaceApi(Module &M, const TargetLibraryInfo &TLI) {
843+
void MemorySanitizer::createUserspaceApi(Module &M,
844+
const TargetLibraryInfo &TLI) {
844845
IRBuilder<> IRB(*C);
845846

846847
// Create the callback.
@@ -910,7 +911,8 @@ void MemorySanitizer::createUserspaceApi(Module &M, const TargetLibraryInfo &TLI
910911
}
911912

912913
/// Insert extern declaration of runtime-provided functions and globals.
913-
void MemorySanitizer::initializeCallbacks(Module &M, const TargetLibraryInfo &TLI) {
914+
void MemorySanitizer::initializeCallbacks(Module &M,
915+
const TargetLibraryInfo &TLI) {
914916
// Only do this once.
915917
if (CallbacksInitialized)
916918
return;
@@ -1245,7 +1247,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
12451247
Value *End =
12461248
IRB.CreateUDiv(RoundUp, ConstantInt::get(MS.IntptrTy, kOriginSize));
12471249
auto [InsertPt, Index] =
1248-
SplitBlockAndInsertSimpleForLoop(End, &*IRB.GetInsertPoint());
1250+
SplitBlockAndInsertSimpleForLoop(End, &*IRB.GetInsertPoint());
12491251
IRB.SetInsertPoint(InsertPt);
12501252

12511253
Value *GEP = IRB.CreateGEP(MS.OriginTy, OriginPtr, Index);
@@ -1652,7 +1654,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
16521654
if (isa<ScalableVectorType>(V->getType()))
16531655
return convertShadowToScalar(IRB.CreateOrReduce(V), IRB);
16541656
unsigned BitWidth =
1655-
V->getType()->getPrimitiveSizeInBits().getFixedValue();
1657+
V->getType()->getPrimitiveSizeInBits().getFixedValue();
16561658
return IRB.CreateBitCast(V, IntegerType::get(*MS.C, BitWidth));
16571659
}
16581660
return V;
@@ -1691,7 +1693,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
16911693
Constant *constToIntPtr(Type *IntPtrTy, uint64_t C) const {
16921694
if (VectorType *VectTy = dyn_cast<VectorType>(IntPtrTy)) {
16931695
return ConstantVector::getSplat(
1694-
VectTy->getElementCount(), constToIntPtr(VectTy->getElementType(), C));
1696+
VectTy->getElementCount(),
1697+
constToIntPtr(VectTy->getElementType(), C));
16951698
}
16961699
assert(IntPtrTy == MS.IntptrTy);
16971700
return ConstantInt::get(MS.IntptrTy, C);
@@ -2008,8 +2011,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
20082011
(void)Cpy;
20092012

20102013
if (MS.TrackOrigins) {
2011-
Value *OriginPtr =
2012-
getOriginPtrForArgument(EntryIRB, ArgOffset);
2014+
Value *OriginPtr = getOriginPtrForArgument(EntryIRB, ArgOffset);
20132015
// FIXME: OriginSize should be:
20142016
// alignTo(V % kMinOriginAlignment + Size, kMinOriginAlignment)
20152017
unsigned OriginSize = alignTo(Size, kMinOriginAlignment);
@@ -2032,8 +2034,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
20322034
ShadowPtr = EntryIRB.CreateAlignedLoad(getShadowTy(&FArg), Base,
20332035
kShadowTLSAlignment);
20342036
if (MS.TrackOrigins) {
2035-
Value *OriginPtr =
2036-
getOriginPtrForArgument(EntryIRB, ArgOffset);
2037+
Value *OriginPtr = getOriginPtrForArgument(EntryIRB, ArgOffset);
20372038
setOrigin(A, EntryIRB.CreateLoad(MS.OriginTy, OriginPtr));
20382039
}
20392040
}
@@ -4651,12 +4652,11 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
46514652
}
46524653
IRBuilder<> IRBAfter(&*NextInsn);
46534654
Value *RetvalShadow = IRBAfter.CreateAlignedLoad(
4654-
getShadowTy(&CB), getShadowPtrForRetval(IRBAfter),
4655-
kShadowTLSAlignment, "_msret");
4655+
getShadowTy(&CB), getShadowPtrForRetval(IRBAfter), kShadowTLSAlignment,
4656+
"_msret");
46564657
setShadow(&CB, RetvalShadow);
46574658
if (MS.TrackOrigins)
4658-
setOrigin(&CB, IRBAfter.CreateLoad(MS.OriginTy,
4659-
getOriginPtrForRetval()));
4659+
setOrigin(&CB, IRBAfter.CreateLoad(MS.OriginTy, getOriginPtrForRetval()));
46604660
}
46614661

46624662
bool isAMustTailRetVal(Value *RetVal) {

0 commit comments

Comments
 (0)