diff options
author | Erich Keane <erich.keane@intel.com> | 2017-04-19 21:24:55 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2017-04-19 21:24:55 +0000 |
commit | 4b87d8106864ca05dcc22b0def7bee91fc562174 (patch) | |
tree | c23f27a88c1d0507ad4202fd514af174c0939628 /clang/lib/AST/Decl.cpp | |
parent | ae382bb6af2c8ac70d0c24ee32418f0980d7f2c8 (diff) | |
download | bcm5719-llvm-4b87d8106864ca05dcc22b0def7bee91fc562174.tar.gz bcm5719-llvm-4b87d8106864ca05dcc22b0def7bee91fc562174.zip |
Corrrect warn_unused_result attribute
The original idea was that if the attribute on an operator,
that the return-value unused-ness wouldn't matter. However,
all of the operators except postfix inc/dec return
references! References don't result in this warning
anyway, so those are already excluded.
Differential Revision: https://reviews.llvm.org/D32207
llvm-svn: 300764
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 2b22e5bb50a..094e8dcff08 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -3003,9 +3003,7 @@ SourceRange FunctionDecl::getExceptionSpecSourceRange() const { const Attr *FunctionDecl::getUnusedResultAttr() const { QualType RetType = getReturnType(); if (RetType->isRecordType()) { - const CXXRecordDecl *Ret = RetType->getAsCXXRecordDecl(); - const auto *MD = dyn_cast<CXXMethodDecl>(this); - if (Ret && !(MD && MD->getCorrespondingMethodInClass(Ret, true))) { + if (const CXXRecordDecl *Ret = RetType->getAsCXXRecordDecl()) { if (const auto *R = Ret->getAttr<WarnUnusedResultAttr>()) return R; } |