diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-30 18:22:15 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-30 18:22:15 +0000 |
commit | f031774aa2638b4d3f487e7e44180c1f89b867ef (patch) | |
tree | f10e7c7f6cbd9d25c33d0648258f7d450f80bb05 /lib/AST/Expr.cpp | |
parent | e0f38678f01291e68fc70ea6056260b54d529307 (diff) |
Add Support for 'warn_unused_result" attribute on
objective-c methods. (radar 7418262).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99903 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 6a71e925d9..b4e5a5d960 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -914,8 +914,15 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1, case CXXConstructExprClass: return false; - case ObjCMessageExprClass: + case ObjCMessageExprClass: { + const ObjCMessageExpr *ME = cast<ObjCMessageExpr>(this); + const ObjCMethodDecl *MD = ME->getMethodDecl(); + if (MD && MD->getAttr<WarnUnusedResultAttr>()) { + Loc = getExprLoc(); + return true; + } return false; + } case ObjCImplicitSetterGetterRefExprClass: { // Dot syntax for message send. #if 0 |