================ @@ -272,6 +273,26 @@ QualType ObjCMessageExpr::getCallReturnType(ASTContext &Ctx) const { return Ctx.getReferenceQualifiedType(this); } +std::pair<const NamedDecl *, const Attr *> +ObjCMessageExpr::getUnusedResultAttr(ASTContext &Ctx) const { + // If the callee is marked nodiscard, return that attribute + if (const ObjCMethodDecl *MD = getMethodDecl()) + if (const auto *A = MD->getAttr<WarnUnusedResultAttr>()) + return {nullptr, A}; ---------------- Sirraide wrote:
Specifically, - `{null, Attribute}` means ‘the function is `nodiscard`’; - `{TD, Attribute}` means ‘the type is `nodiscard`, please include `TD` in the diagnostic; - `{null, null}` means ‘not `nodiscard`’ I *thought* there was a comment about this somewhere, but if not should probably add one https://github.com/llvm/llvm-project/pull/142541 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits