Skip to content

Silence warn_unused_result warnings #6900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/IRGen/GenBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, Identifier FnId,
if (Builtin.ID == BuiltinValueKind::UnsafeGuaranteedEnd) {
// Just consume the incoming argument.
assert(args.size() == 1 && "Expecting one incoming argument");
args.claimAll();
(void)args.claimAll();
return;
}

Expand All @@ -146,23 +146,23 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, Identifier FnId,

// These builtins don't care about their argument:
if (Builtin.ID == BuiltinValueKind::Sizeof) {
args.claimAll();
(void)args.claimAll();
auto valueTy = getLoweredTypeAndTypeInfo(IGF.IGM,
substitutions[0].getReplacement());
out.add(valueTy.second.getSize(IGF, valueTy.first));
return;
}

if (Builtin.ID == BuiltinValueKind::Strideof) {
args.claimAll();
(void)args.claimAll();
auto valueTy = getLoweredTypeAndTypeInfo(IGF.IGM,
substitutions[0].getReplacement());
out.add(valueTy.second.getStride(IGF, valueTy.first));
return;
}

if (Builtin.ID == BuiltinValueKind::Alignof) {
args.claimAll();
(void)args.claimAll();
auto valueTy = getLoweredTypeAndTypeInfo(IGF.IGM,
substitutions[0].getReplacement());
// The alignof value is one greater than the alignment mask.
Expand All @@ -173,7 +173,7 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, Identifier FnId,
}

if (Builtin.ID == BuiltinValueKind::IsPOD) {
args.claimAll();
(void)args.claimAll();
auto valueTy = getLoweredTypeAndTypeInfo(IGF.IGM,
substitutions[0].getReplacement());
out.add(valueTy.second.getIsPOD(IGF, valueTy.first));
Expand Down Expand Up @@ -832,7 +832,7 @@ if (Builtin.ID == BuiltinValueKind::id) { \
}

if (Builtin.ID == BuiltinValueKind::GetObjCTypeEncoding) {
args.claimAll();
(void)args.claimAll();
Type valueTy = substitutions[0].getReplacement();
// Get the type encoding for the associated clang type.
auto clangTy = IGF.IGM.getClangType(valueTy->getCanonicalType());
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/GenCast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ void irgen::emitScalarCheckedCast(IRGenFunction &IGF,
// value, which we don't need.
// TODO: In existential-to-existential casts, we should carry over common
// witness tables from the source to the destination.
value.claimAll();
(void)value.claimAll();

SmallVector<ProtocolDecl*, 1> protocols;

Expand Down
22 changes: 11 additions & 11 deletions lib/IRGen/GenEnum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ namespace {
emitValueCaseTest(IRGenFunction &IGF,
Explosion &value,
EnumElementDecl *Case) const override {
value.claim(getExplosionSize());
(void)value.claim(getExplosionSize());
return IGF.Builder.getInt1(true);
}
llvm::Value *
Expand All @@ -330,7 +330,7 @@ namespace {
ArrayRef<std::pair<EnumElementDecl*,
llvm::BasicBlock*>> dests,
llvm::BasicBlock *defaultDest) const override {
value.claim(getExplosionSize());
(void)value.claim(getExplosionSize());
emitSingletonSwitch(IGF, dests, defaultDest);
}

Expand Down Expand Up @@ -788,7 +788,7 @@ namespace {
EnumElementDecl *elt,
Explosion &out) const override {
// All of the cases project an empty explosion.
in.claim(getExplosionSize());
(void)in.claim(getExplosionSize());
}

void emitValueInjection(IRGenFunction &IGF,
Expand Down Expand Up @@ -1498,7 +1498,7 @@ namespace {
auto &loadableTI = getLoadablePayloadTypeInfo();
loadableTI.unpackFromEnumPayload(IGF, payload, payloadValue, 0);
loadableTI.copy(IGF, payloadValue, payloadCopy, Atomicity::Atomic);
payloadCopy.claimAll(); // FIXME: repack if not bit-identical
(void)payloadCopy.claimAll(); // FIXME: repack if not bit-identical
}

IGF.Builder.CreateBr(endBB);
Expand Down Expand Up @@ -2003,7 +2003,7 @@ namespace {
// Only the payload case has anything to project. The other cases are
// empty.
if (theCase != getPayloadElement()) {
inEnum.claim(getExplosionSize());
(void)inEnum.claim(getExplosionSize());
return;
}

Expand Down Expand Up @@ -2286,7 +2286,7 @@ namespace {

switch (CopyDestroyKind) {
case POD:
src.claim(getExplosionSize());
(void)src.claim(getExplosionSize());
return;

case Normal: {
Expand Down Expand Up @@ -2316,7 +2316,7 @@ namespace {

switch (CopyDestroyKind) {
case POD:
src.claim(getExplosionSize());
(void)src.claim(getExplosionSize());
return;

case Normal: {
Expand Down Expand Up @@ -2912,7 +2912,7 @@ namespace {

Explosion tmp;
lti.copy(IGF, value, tmp, Atomicity::Atomic);
tmp.claimAll(); // FIXME: repack if not bit-identical
(void)tmp.claimAll(); // FIXME: repack if not bit-identical
});

IGF.Builder.CreateRetVoid();
Expand Down Expand Up @@ -3659,7 +3659,7 @@ namespace {

// Non-payload cases project to an empty explosion.
if (foundPayload == ElementsWithPayload.end()) {
inValue.claim(getExplosionSize());
(void)inValue.claim(getExplosionSize());
return;
}

Expand Down Expand Up @@ -3964,7 +3964,7 @@ namespace {
assert(TIK >= Loadable);
switch (CopyDestroyKind) {
case POD:
src.claim(getExplosionSize());
(void)src.claim(getExplosionSize());
return;

case BitwiseTakable:
Expand Down Expand Up @@ -3997,7 +3997,7 @@ namespace {

switch (CopyDestroyKind) {
case POD:
src.claim(getExplosionSize());
(void)src.claim(getExplosionSize());
return;

case BitwiseTakable:
Expand Down
18 changes: 9 additions & 9 deletions lib/IRGen/GenExistential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ class ScalarExistentialTypeInfoBase :
/// Given an existential object, returns the payload value.
llvm::Value *getValue(IRGenFunction &IGF, Explosion &container) const {
llvm::Value *instance = container.claimNext();
container.claim(getNumStoredProtocols());
(void)container.claim(getNumStoredProtocols());
return instance;
}

Expand Down Expand Up @@ -806,7 +806,7 @@ class ScalarExistentialTypeInfoBase :
asDerived().emitValueRelease(IGF, value, atomicity);

// Throw out the witness table pointers.
src.claim(getNumStoredProtocols());
(void)src.claim(getNumStoredProtocols());
}

void fixLifetime(IRGenFunction &IGF, Explosion &src) const override {
Expand All @@ -815,7 +815,7 @@ class ScalarExistentialTypeInfoBase :
asDerived().emitValueFixLifetime(IGF, value);

// Throw out the witness table pointers.
src.claim(getNumStoredProtocols());
(void)src.claim(getNumStoredProtocols());
}

void destroy(IRGenFunction &IGF, Address addr, SILType T) const override {
Expand Down Expand Up @@ -1067,34 +1067,34 @@ class ClassExistentialTypeInfo final
void strongRetain(IRGenFunction &IGF, Explosion &e,
Atomicity atomicity) const override {
IGF.emitStrongRetain(e.claimNext(), Refcounting, atomicity);
e.claim(getNumStoredProtocols());
(void)e.claim(getNumStoredProtocols());
}

void strongRelease(IRGenFunction &IGF, Explosion &e,
Atomicity atomicity) const override {
IGF.emitStrongRelease(e.claimNext(), Refcounting, atomicity);
e.claim(getNumStoredProtocols());
(void)e.claim(getNumStoredProtocols());
}

void strongRetainUnowned(IRGenFunction &IGF, Explosion &e) const override {
IGF.emitStrongRetainUnowned(e.claimNext(), Refcounting);
e.claim(getNumStoredProtocols());
(void)e.claim(getNumStoredProtocols());
}

void strongRetainUnownedRelease(IRGenFunction &IGF,
Explosion &e) const override {
IGF.emitStrongRetainAndUnownedRelease(e.claimNext(), Refcounting);
e.claim(getNumStoredProtocols());
(void)e.claim(getNumStoredProtocols());
}

void unownedRetain(IRGenFunction &IGF, Explosion &e) const override {
IGF.emitUnownedRetain(e.claimNext(), Refcounting);
e.claim(getNumStoredProtocols());
(void)e.claim(getNumStoredProtocols());
}

void unownedRelease(IRGenFunction &IGF, Explosion &e) const override {
IGF.emitUnownedRelease(e.claimNext(), Refcounting);
e.claim(getNumStoredProtocols());
(void)e.claim(getNumStoredProtocols());
}

void unownedLoadStrong(IRGenFunction &IGF, Address existential,
Expand Down
14 changes: 7 additions & 7 deletions lib/IRGen/IRGenSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2696,7 +2696,7 @@ mapTriviallyToInt(IRGenSILFunction &IGF, const EnumImplStrategy &EIS, SelectEnum
Explosion enumValue = IGF.getLoweredExplosion(inst->getEnumOperand());
llvm::Value *result = EIS.emitExtractDiscriminator(IGF, enumValue);
if (!result) {
enumValue.claimAll();
(void)enumValue.claimAll();
return nullptr;
}

Expand Down Expand Up @@ -2945,7 +2945,7 @@ void IRGenSILFunction::visitRetainValueInst(swift::RetainValueInst *i) {
cast<LoadableTypeInfo>(getTypeInfo(i->getOperand()->getType()))
.copy(*this, in, out, i->isAtomic() ? irgen::Atomicity::Atomic
: irgen::Atomicity::NonAtomic);
out.claimAll();
(void)out.claimAll();
}

void IRGenSILFunction::visitCopyValueInst(swift::CopyValueInst *i) {
Expand Down Expand Up @@ -3078,7 +3078,7 @@ void IRGenSILFunction::visitTupleExtractInst(swift::TupleExtractInst *i) {
fullTuple,
i->getFieldNo(),
output);
fullTuple.claimAll();
(void)fullTuple.claimAll();
setLoweredExplosion(i, output);
}

Expand All @@ -3103,7 +3103,7 @@ void IRGenSILFunction::visitStructExtractInst(swift::StructExtractInst *i) {
i->getField(),
lowered);

operand.claimAll();
(void)operand.claimAll();
setLoweredExplosion(i, lowered);
}

Expand Down Expand Up @@ -3803,7 +3803,7 @@ static void emitPointerCastInst(IRGenSILFunction &IGF,
llvm::Value *ptrValue = from.claimNext();
// The input may have witness tables or other additional data, but the class
// reference is always first.
from.claimAll();
(void)from.claimAll();

auto schema = ti.getSchema();
assert(schema.size() == 1
Expand Down Expand Up @@ -3879,7 +3879,7 @@ static void emitTrapAndUndefValue(IRGenSILFunction &IGF,

llvm::BasicBlock *contBB = llvm::BasicBlock::Create(IGF.IGM.getLLVMContext());
IGF.Builder.emitBlock(contBB);
in.claimAll();
(void)in.claimAll();
for (auto schema : outTI.getSchema())
out.add(llvm::UndefValue::get(schema.getScalarType()));
}
Expand Down Expand Up @@ -4080,7 +4080,7 @@ void IRGenSILFunction::visitObjCExistentialMetatypeToObjectInst(
// can drop.
Explosion from = getLoweredExplosion(i->getOperand());
llvm::Value *value = from.claimNext();
from.claimAll();
(void)from.claimAll();
value = Builder.CreateBitCast(value, IGM.UnknownRefCountedPtrTy);
Explosion to;
to.add(value);
Expand Down
2 changes: 1 addition & 1 deletion lib/SILGen/SILGenApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4349,7 +4349,7 @@ namespace {
// The captures are represented as a placeholder curry level in the
// formal type.
// TODO: Remove this hack.
paramLowering.claimCaptureParams(callee.getCaptures());
(void)paramLowering.claimCaptureParams(callee.getCaptures());
claimNextParamClause(origFormalType);
claimNextParamClause(formalType);
args.push_back({});
Expand Down