erik.pilkington accepted this revision. erik.pilkington added a comment. This revision is now accepted and ready to land.
LGTM! ================ Comment at: lib/AST/Expr.cpp:2281-2286 + // If there is no FunctionDecl for the call, check the return type of the + // callee to see if it was declared with the WarnUnusedResult attribute. + if (!Func && !HasWarnUnusedResultAttr) { + if (const TagDecl *TD = CE->getCallReturnType(Ctx)->getAsTagDecl()) + HasWarnUnusedResultAttr = TD->hasAttr<WarnUnusedResultAttr>(); + } ---------------- This duplicates some logic from FunctionDecl::hasUnusedResultAttr(), maybe we should move that member function to the CallExpr? ================ Comment at: test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp:51 + + one(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} + two(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} ---------------- This diagnostic should also probably be improved at some point, the function wasn't declared 'nodiscard', the type was. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55949/new/ https://reviews.llvm.org/D55949 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits