================
@@ -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>())
----------------
Mick235711 wrote:
Indeed, it seems I forgot to add a check for `nullptr`.
Will open a PR to fix this later today.
https://github.com/llvm/llvm-project/pull/112521
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits