aboutsummaryrefslogtreecommitdiff
path: root/clang/include/clang/AST/Expr.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include/clang/AST/Expr.h')
-rw-r--r--clang/include/clang/AST/Expr.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 523c032..708c6e2 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -16,6 +16,7 @@
#include "clang/AST/APNumericStorage.h"
#include "clang/AST/APValue.h"
#include "clang/AST/ASTVector.h"
+#include "clang/AST/Attr.h"
#include "clang/AST/ComputeDependence.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclAccessPair.h"
@@ -262,6 +263,12 @@ public:
SourceRange &R1, SourceRange &R2,
ASTContext &Ctx) const;
+ /// Returns the WarnUnusedResultAttr that is declared on the callee
+ /// or its return type declaration, together with a NamedDecl that
+ /// refers to the declaration the attribute is attached to.
+ static std::pair<const NamedDecl *, const WarnUnusedResultAttr *>
+ getUnusedResultAttrImpl(const Decl *Callee, QualType ReturnType);
+
/// isLValue - True if this expression is an "l-value" according to
/// the rules of the current language. C and C++ give somewhat
/// different rules for this concept, but in general, the result of
@@ -3190,11 +3197,13 @@ public:
/// type.
QualType getCallReturnType(const ASTContext &Ctx) const;
- /// Returns the WarnUnusedResultAttr that is either declared on the called
- /// function, or its return type declaration, together with a NamedDecl that
- /// refers to the declaration the attribute is attached onto.
- std::pair<const NamedDecl *, const Attr *>
- getUnusedResultAttr(const ASTContext &Ctx) const;
+ /// Returns the WarnUnusedResultAttr that is declared on the callee
+ /// or its return type declaration, together with a NamedDecl that
+ /// refers to the declaration the attribute is attached to.
+ std::pair<const NamedDecl *, const WarnUnusedResultAttr *>
+ getUnusedResultAttr(const ASTContext &Ctx) const {
+ return getUnusedResultAttrImpl(getCalleeDecl(), getCallReturnType(Ctx));
+ }
/// Returns true if this call expression should warn on unused results.
bool hasUnusedResultAttr(const ASTContext &Ctx) const {