Skip to content

Commit 67ef994

Browse files
Merge pull request #6900 from aschwaighofer/fix_silence_warn_unused_result_warning
Silence warn_unused_result warnings
2 parents 111b236 + 1f914eb commit 67ef994

File tree

6 files changed

+35
-35
lines changed

6 files changed

+35
-35
lines changed

lib/IRGen/GenBuiltin.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void irgen::emitBuiltinCall(IRGenFunction &IGF, Identifier FnId,
125125
if (Builtin.ID == BuiltinValueKind::UnsafeGuaranteedEnd) {
126126
// Just consume the incoming argument.
127127
assert(args.size() == 1 && "Expecting one incoming argument");
128-
args.claimAll();
128+
(void)args.claimAll();
129129
return;
130130
}
131131

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

147147
// These builtins don't care about their argument:
148148
if (Builtin.ID == BuiltinValueKind::Sizeof) {
149-
args.claimAll();
149+
(void)args.claimAll();
150150
auto valueTy = getLoweredTypeAndTypeInfo(IGF.IGM,
151151
substitutions[0].getReplacement());
152152
out.add(valueTy.second.getSize(IGF, valueTy.first));
153153
return;
154154
}
155155

156156
if (Builtin.ID == BuiltinValueKind::Strideof) {
157-
args.claimAll();
157+
(void)args.claimAll();
158158
auto valueTy = getLoweredTypeAndTypeInfo(IGF.IGM,
159159
substitutions[0].getReplacement());
160160
out.add(valueTy.second.getStride(IGF, valueTy.first));
161161
return;
162162
}
163163

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

175175
if (Builtin.ID == BuiltinValueKind::IsPOD) {
176-
args.claimAll();
176+
(void)args.claimAll();
177177
auto valueTy = getLoweredTypeAndTypeInfo(IGF.IGM,
178178
substitutions[0].getReplacement());
179179
out.add(valueTy.second.getIsPOD(IGF, valueTy.first));
@@ -832,7 +832,7 @@ if (Builtin.ID == BuiltinValueKind::id) { \
832832
}
833833

834834
if (Builtin.ID == BuiltinValueKind::GetObjCTypeEncoding) {
835-
args.claimAll();
835+
(void)args.claimAll();
836836
Type valueTy = substitutions[0].getReplacement();
837837
// Get the type encoding for the associated clang type.
838838
auto clangTy = IGF.IGM.getClangType(valueTy->getCanonicalType());

lib/IRGen/GenCast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ void irgen::emitScalarCheckedCast(IRGenFunction &IGF,
759759
// value, which we don't need.
760760
// TODO: In existential-to-existential casts, we should carry over common
761761
// witness tables from the source to the destination.
762-
value.claimAll();
762+
(void)value.claimAll();
763763

764764
SmallVector<ProtocolDecl*, 1> protocols;
765765

lib/IRGen/GenEnum.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ namespace {
304304
emitValueCaseTest(IRGenFunction &IGF,
305305
Explosion &value,
306306
EnumElementDecl *Case) const override {
307-
value.claim(getExplosionSize());
307+
(void)value.claim(getExplosionSize());
308308
return IGF.Builder.getInt1(true);
309309
}
310310
llvm::Value *
@@ -330,7 +330,7 @@ namespace {
330330
ArrayRef<std::pair<EnumElementDecl*,
331331
llvm::BasicBlock*>> dests,
332332
llvm::BasicBlock *defaultDest) const override {
333-
value.claim(getExplosionSize());
333+
(void)value.claim(getExplosionSize());
334334
emitSingletonSwitch(IGF, dests, defaultDest);
335335
}
336336

@@ -788,7 +788,7 @@ namespace {
788788
EnumElementDecl *elt,
789789
Explosion &out) const override {
790790
// All of the cases project an empty explosion.
791-
in.claim(getExplosionSize());
791+
(void)in.claim(getExplosionSize());
792792
}
793793

794794
void emitValueInjection(IRGenFunction &IGF,
@@ -1498,7 +1498,7 @@ namespace {
14981498
auto &loadableTI = getLoadablePayloadTypeInfo();
14991499
loadableTI.unpackFromEnumPayload(IGF, payload, payloadValue, 0);
15001500
loadableTI.copy(IGF, payloadValue, payloadCopy, Atomicity::Atomic);
1501-
payloadCopy.claimAll(); // FIXME: repack if not bit-identical
1501+
(void)payloadCopy.claimAll(); // FIXME: repack if not bit-identical
15021502
}
15031503

15041504
IGF.Builder.CreateBr(endBB);
@@ -2003,7 +2003,7 @@ namespace {
20032003
// Only the payload case has anything to project. The other cases are
20042004
// empty.
20052005
if (theCase != getPayloadElement()) {
2006-
inEnum.claim(getExplosionSize());
2006+
(void)inEnum.claim(getExplosionSize());
20072007
return;
20082008
}
20092009

@@ -2286,7 +2286,7 @@ namespace {
22862286

22872287
switch (CopyDestroyKind) {
22882288
case POD:
2289-
src.claim(getExplosionSize());
2289+
(void)src.claim(getExplosionSize());
22902290
return;
22912291

22922292
case Normal: {
@@ -2316,7 +2316,7 @@ namespace {
23162316

23172317
switch (CopyDestroyKind) {
23182318
case POD:
2319-
src.claim(getExplosionSize());
2319+
(void)src.claim(getExplosionSize());
23202320
return;
23212321

23222322
case Normal: {
@@ -2912,7 +2912,7 @@ namespace {
29122912

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

29182918
IGF.Builder.CreateRetVoid();
@@ -3659,7 +3659,7 @@ namespace {
36593659

36603660
// Non-payload cases project to an empty explosion.
36613661
if (foundPayload == ElementsWithPayload.end()) {
3662-
inValue.claim(getExplosionSize());
3662+
(void)inValue.claim(getExplosionSize());
36633663
return;
36643664
}
36653665

@@ -3964,7 +3964,7 @@ namespace {
39643964
assert(TIK >= Loadable);
39653965
switch (CopyDestroyKind) {
39663966
case POD:
3967-
src.claim(getExplosionSize());
3967+
(void)src.claim(getExplosionSize());
39683968
return;
39693969

39703970
case BitwiseTakable:
@@ -3997,7 +3997,7 @@ namespace {
39973997

39983998
switch (CopyDestroyKind) {
39993999
case POD:
4000-
src.claim(getExplosionSize());
4000+
(void)src.claim(getExplosionSize());
40014001
return;
40024002

40034003
case BitwiseTakable:

lib/IRGen/GenExistential.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ class ScalarExistentialTypeInfoBase :
741741
/// Given an existential object, returns the payload value.
742742
llvm::Value *getValue(IRGenFunction &IGF, Explosion &container) const {
743743
llvm::Value *instance = container.claimNext();
744-
container.claim(getNumStoredProtocols());
744+
(void)container.claim(getNumStoredProtocols());
745745
return instance;
746746
}
747747

@@ -806,7 +806,7 @@ class ScalarExistentialTypeInfoBase :
806806
asDerived().emitValueRelease(IGF, value, atomicity);
807807

808808
// Throw out the witness table pointers.
809-
src.claim(getNumStoredProtocols());
809+
(void)src.claim(getNumStoredProtocols());
810810
}
811811

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

817817
// Throw out the witness table pointers.
818-
src.claim(getNumStoredProtocols());
818+
(void)src.claim(getNumStoredProtocols());
819819
}
820820

821821
void destroy(IRGenFunction &IGF, Address addr, SILType T) const override {
@@ -1067,34 +1067,34 @@ class ClassExistentialTypeInfo final
10671067
void strongRetain(IRGenFunction &IGF, Explosion &e,
10681068
Atomicity atomicity) const override {
10691069
IGF.emitStrongRetain(e.claimNext(), Refcounting, atomicity);
1070-
e.claim(getNumStoredProtocols());
1070+
(void)e.claim(getNumStoredProtocols());
10711071
}
10721072

10731073
void strongRelease(IRGenFunction &IGF, Explosion &e,
10741074
Atomicity atomicity) const override {
10751075
IGF.emitStrongRelease(e.claimNext(), Refcounting, atomicity);
1076-
e.claim(getNumStoredProtocols());
1076+
(void)e.claim(getNumStoredProtocols());
10771077
}
10781078

10791079
void strongRetainUnowned(IRGenFunction &IGF, Explosion &e) const override {
10801080
IGF.emitStrongRetainUnowned(e.claimNext(), Refcounting);
1081-
e.claim(getNumStoredProtocols());
1081+
(void)e.claim(getNumStoredProtocols());
10821082
}
10831083

10841084
void strongRetainUnownedRelease(IRGenFunction &IGF,
10851085
Explosion &e) const override {
10861086
IGF.emitStrongRetainAndUnownedRelease(e.claimNext(), Refcounting);
1087-
e.claim(getNumStoredProtocols());
1087+
(void)e.claim(getNumStoredProtocols());
10881088
}
10891089

10901090
void unownedRetain(IRGenFunction &IGF, Explosion &e) const override {
10911091
IGF.emitUnownedRetain(e.claimNext(), Refcounting);
1092-
e.claim(getNumStoredProtocols());
1092+
(void)e.claim(getNumStoredProtocols());
10931093
}
10941094

10951095
void unownedRelease(IRGenFunction &IGF, Explosion &e) const override {
10961096
IGF.emitUnownedRelease(e.claimNext(), Refcounting);
1097-
e.claim(getNumStoredProtocols());
1097+
(void)e.claim(getNumStoredProtocols());
10981098
}
10991099

11001100
void unownedLoadStrong(IRGenFunction &IGF, Address existential,

lib/IRGen/IRGenSIL.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,7 +2696,7 @@ mapTriviallyToInt(IRGenSILFunction &IGF, const EnumImplStrategy &EIS, SelectEnum
26962696
Explosion enumValue = IGF.getLoweredExplosion(inst->getEnumOperand());
26972697
llvm::Value *result = EIS.emitExtractDiscriminator(IGF, enumValue);
26982698
if (!result) {
2699-
enumValue.claimAll();
2699+
(void)enumValue.claimAll();
27002700
return nullptr;
27012701
}
27022702

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

29512951
void IRGenSILFunction::visitCopyValueInst(swift::CopyValueInst *i) {
@@ -3078,7 +3078,7 @@ void IRGenSILFunction::visitTupleExtractInst(swift::TupleExtractInst *i) {
30783078
fullTuple,
30793079
i->getFieldNo(),
30803080
output);
3081-
fullTuple.claimAll();
3081+
(void)fullTuple.claimAll();
30823082
setLoweredExplosion(i, output);
30833083
}
30843084

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

3106-
operand.claimAll();
3106+
(void)operand.claimAll();
31073107
setLoweredExplosion(i, lowered);
31083108
}
31093109

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

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

38803880
llvm::BasicBlock *contBB = llvm::BasicBlock::Create(IGF.IGM.getLLVMContext());
38813881
IGF.Builder.emitBlock(contBB);
3882-
in.claimAll();
3882+
(void)in.claimAll();
38833883
for (auto schema : outTI.getSchema())
38843884
out.add(llvm::UndefValue::get(schema.getScalarType()));
38853885
}
@@ -4080,7 +4080,7 @@ void IRGenSILFunction::visitObjCExistentialMetatypeToObjectInst(
40804080
// can drop.
40814081
Explosion from = getLoweredExplosion(i->getOperand());
40824082
llvm::Value *value = from.claimNext();
4083-
from.claimAll();
4083+
(void)from.claimAll();
40844084
value = Builder.CreateBitCast(value, IGM.UnknownRefCountedPtrTy);
40854085
Explosion to;
40864086
to.add(value);

lib/SILGen/SILGenApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4349,7 +4349,7 @@ namespace {
43494349
// The captures are represented as a placeholder curry level in the
43504350
// formal type.
43514351
// TODO: Remove this hack.
4352-
paramLowering.claimCaptureParams(callee.getCaptures());
4352+
(void)paramLowering.claimCaptureParams(callee.getCaptures());
43534353
claimNextParamClause(origFormalType);
43544354
claimNextParamClause(formalType);
43554355
args.push_back({});

0 commit comments

Comments
 (0)