Skip to content

Commit 1f7ba23

Browse files
authored
[NFC] [MSAN] replace (void) with [[maybe_unused]] (#146617)
The latter is preferred in the LLVM style guide.
1 parent 6ecb6a8 commit 1f7ba23

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,9 +1392,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
13921392
std::tie(ShadowPtr, OriginPtr) =
13931393
getShadowOriginPtr(Addr, IRB, ShadowTy, Alignment, /*isStore*/ true);
13941394

1395-
StoreInst *NewSI = IRB.CreateAlignedStore(Shadow, ShadowPtr, Alignment);
1395+
[[maybe_unused]] StoreInst *NewSI =
1396+
IRB.CreateAlignedStore(Shadow, ShadowPtr, Alignment);
13961397
LLVM_DEBUG(dbgs() << " STORE: " << *NewSI << "\n");
1397-
(void)NewSI;
13981398

13991399
if (SI->isAtomic())
14001400
SI->setOrdering(addReleaseOrdering(SI->getOrdering()));
@@ -2021,18 +2021,16 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
20212021
Value *Shadow = ShadowMap[V];
20222022
if (!Shadow) {
20232023
LLVM_DEBUG(dbgs() << "No shadow: " << *V << "\n" << *(I->getParent()));
2024-
(void)I;
20252024
assert(Shadow && "No shadow for a value");
20262025
}
20272026
return Shadow;
20282027
}
20292028
// Handle fully undefined values
20302029
// (partially undefined constant vectors are handled later)
2031-
if (UndefValue *U = dyn_cast<UndefValue>(V)) {
2030+
if ([[maybe_unused]] UndefValue *U = dyn_cast<UndefValue>(V)) {
20322031
Value *AllOnes = (PropagateShadow && PoisonUndef) ? getPoisonedShadow(V)
20332032
: getCleanShadow(V);
20342033
LLVM_DEBUG(dbgs() << "Undef: " << *U << " ==> " << *AllOnes << "\n");
2035-
(void)U;
20362034
return AllOnes;
20372035
}
20382036
if (Argument *A = dyn_cast<Argument>(V)) {
@@ -2081,10 +2079,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
20812079
} else {
20822080
Value *Base = getShadowPtrForArgument(EntryIRB, ArgOffset);
20832081
const Align CopyAlign = std::min(ArgAlign, kShadowTLSAlignment);
2084-
Value *Cpy = EntryIRB.CreateMemCpy(CpShadowPtr, CopyAlign, Base,
2085-
CopyAlign, Size);
2082+
[[maybe_unused]] Value *Cpy = EntryIRB.CreateMemCpy(
2083+
CpShadowPtr, CopyAlign, Base, CopyAlign, Size);
20862084
LLVM_DEBUG(dbgs() << " ByValCpy: " << *Cpy << "\n");
2087-
(void)Cpy;
20882085

20892086
if (MS.TrackOrigins) {
20902087
Value *OriginPtr = getOriginPtrForArgument(EntryIRB, ArgOffset);
@@ -5566,7 +5563,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
55665563
insertShadowCheck(A, &CB);
55675564
Size = DL.getTypeAllocSize(A->getType());
55685565
} else {
5569-
Value *Store = nullptr;
5566+
[[maybe_unused]] Value *Store = nullptr;
55705567
// Compute the Shadow for arg even if it is ByVal, because
55715568
// in that case getShadow() will copy the actual arg shadow to
55725569
// __msan_param_tls.
@@ -5623,7 +5620,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
56235620
getOriginPtrForArgument(IRB, ArgOffset));
56245621
}
56255622
}
5626-
(void)Store;
56275623
assert(Store != nullptr);
56285624
LLVM_DEBUG(dbgs() << " Param:" << *Store << "\n");
56295625
}

0 commit comments

Comments
 (0)