Skip to content

Commit 72456f5

Browse files
authored
Merge pull request swiftlang#12496 from davezarzycki/nfc_ExtInfo_withAPI_warn_unused_result
[AST] NFC: Warn if ExtInfo "with*" API results are unused
2 parents 90d71c3 + bed0e27 commit 72456f5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/swift/AST/Types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,22 +2473,26 @@ class AnyFunctionType : public TypeBase {
24732473

24742474
// Note that we don't have setters. That is by design, use
24752475
// the following with methods instead of mutating these objects.
2476+
LLVM_NODISCARD
24762477
ExtInfo withRepresentation(Representation Rep) const {
24772478
return ExtInfo((Bits & ~RepresentationMask)
24782479
| (unsigned)Rep);
24792480
}
2481+
LLVM_NODISCARD
24802482
ExtInfo withIsAutoClosure(bool IsAutoClosure = true) const {
24812483
if (IsAutoClosure)
24822484
return ExtInfo(Bits | AutoClosureMask);
24832485
else
24842486
return ExtInfo(Bits & ~AutoClosureMask);
24852487
}
2488+
LLVM_NODISCARD
24862489
ExtInfo withNoEscape(bool NoEscape = true) const {
24872490
if (NoEscape)
24882491
return ExtInfo(Bits | NoEscapeMask);
24892492
else
24902493
return ExtInfo(Bits & ~NoEscapeMask);
24912494
}
2495+
LLVM_NODISCARD
24922496
ExtInfo withThrows(bool Throws = true) const {
24932497
if (Throws)
24942498
return ExtInfo(Bits | ThrowsMask);

0 commit comments

Comments
 (0)