[clang] [clang] Fix missing check for nullptr in CallExpr::getUnusedResultAttr (PR #118636)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 08:25:59 PST 2024


================
@@ -1619,8 +1619,9 @@ 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>())
-    return {nullptr, A};
+  if (D != nullptr)
----------------
zwuis wrote:

```suggestion
  if (const Decl *D = getCalleeDecl())
```


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


More information about the cfe-commits mailing list