[clang] [clang] Add the candiscard attribute to suppress nodiscard (PR #154943)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 25 22:13:50 PDT 2025


================
@@ -3646,6 +3646,14 @@ def Unavailable : InheritableAttr {
   let MeaningfulToClassTemplateDefinition = 1;
 }
 
+def CanDiscard : InheritableAttr {
+  let Spellings = [CXX11<"clang", "candiscard">,
+                   GCC<"candiscard">];
+  let Subjects = SubjectList<[ObjCMethod, FunctionLike, TypedefName]>;
----------------
halbi2 wrote:

I have added tests for member function pointers. Function references should work the same as functions and function pointers. I could not find any tests for `warn_unused_result` or `nodiscard` applied to blocks... should I start a new test.cpp file for blocks?

https://github.com/llvm/llvm-project/pull/154943


More information about the cfe-commits mailing list