File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -546,7 +546,7 @@ class RefCountBitsT {
546546 // Returns true if the increment is a fast-path result.
547547 // Returns false if the increment should fall back to some slow path
548548 // (for example, because UseSlowRC is set or because the refcount overflowed).
549- LLVM_NODISCARD SWIFT_ALWAYS_INLINE bool
549+ SWIFT_NODISCARD SWIFT_ALWAYS_INLINE bool
550550 incrementStrongExtraRefCount (uint32_t inc) {
551551 // This deliberately overflows into the UseSlowRC field.
552552 bits += BitsType (inc) << Offsets::StrongExtraRefCountShift;
@@ -557,7 +557,7 @@ class RefCountBitsT {
557557 // Returns false if the decrement should fall back to some slow path
558558 // (for example, because UseSlowRC is set
559559 // or because the refcount is now zero and should deinit).
560- LLVM_NODISCARD SWIFT_ALWAYS_INLINE bool
560+ SWIFT_NODISCARD SWIFT_ALWAYS_INLINE bool
561561 decrementStrongExtraRefCount (uint32_t dec) {
562562#ifndef NDEBUG
563563 if (!hasSideTable () && !isImmortal (false )) {
@@ -1409,8 +1409,8 @@ class HeapObjectSideTableEntry {
14091409
14101410
14111411 // WEAK
1412-
1413- LLVM_NODISCARD
1412+
1413+ SWIFT_NODISCARD
14141414 HeapObjectSideTableEntry* incrementWeak () {
14151415 // incrementWeak need not be atomic w.r.t. concurrent deinit initiation.
14161416 // The client can't actually get a reference to the object without
Original file line number Diff line number Diff line change 149149#define SWIFT_FALLTHROUGH
150150#endif
151151
152+ #if __cplusplus >= 201402l && __has_cpp_attribute(nodiscard)
153+ #define SWIFT_NODISCARD [[nodiscard]]
154+ #elif __has_cpp_attribute(clang::warn_unused_result)
155+ #define SWIFT_NODISCARD [[clang::warn_unused_result]]
156+ #else
157+ #define SWIFT_NODISCARD
158+ #endif
159+
152160
153161// / Attributes for runtime-stdlib interfaces.
154162// / Use these for C implementations that are imported into Swift via SwiftShims
You can’t perform that action at this time.
0 commit comments