[clang] [clang] Add the candiscard attribute to suppress nodiscard (PR #154943)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 22 08:11:55 PDT 2025
================
@@ -8,16 +8,26 @@
using NI [[nodiscard]] = int; // expected-warning {{'[[nodiscard]]' attribute ignored when applied to a typedef}}
using WURI [[clang::warn_unused_result]] = int;
+using EIgnored [[clang::candiscard]] = E;
+using NIIgnored [[clang::candiscard]] = NI;
+using WURIgnored [[clang::candiscard]] = WURI;
+
@interface INTF
- (int) a [[nodiscard]];
+ (int) b [[nodiscard]];
- (expected<int>) c;
+ (expected<int>) d;
- (E) e;
+- (EIgnored) e_ignored;
+- (E) e_ignored2 [[clang::candiscard]];
----------------
erichkeane wrote:
I THINK this is an ObjC method? If so, then disregard the part I commented above regarding ObjC as a subjecdt, looks liek this was intentional/has reasonable semantics.
https://github.com/llvm/llvm-project/pull/154943
More information about the cfe-commits
mailing list