================ @@ -1615,22 +1615,24 @@ QualType CallExpr::getCallReturnType(const ASTContext &Ctx) const { return FnType->getReturnType(); } -const Attr *CallExpr::getUnusedResultAttr(const ASTContext &Ctx) const { +std::pair<const NamedDecl *, const Attr *> +CallExpr::getUnusedResultAttr(const ASTContext &Ctx) const { + // If the callee is marked nodiscard, return that attribute + const Decl *D = getCalleeDecl(); + if (const auto *A = D->getAttr<WarnUnusedResultAttr>()) ---------------- shafik wrote:
This looks like an unconditional access of `D` but it is not obvious this is a correct assumption https://github.com/llvm/llvm-project/pull/112521 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits