summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-02-09 07:24:41 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-02-09 07:24:41 +0000
commit080a61c21b5e2164c842cc73e33e1f4f3b41805a (patch)
tree5daf983d0cd860bc13f67651063460475916c5dc /clang/lib
parent31afdb8c2673e7447bbc90782c5d21efa6da2f62 (diff)
downloadbcm5719-llvm-080a61c21b5e2164c842cc73e33e1f4f3b41805a.tar.gz
bcm5719-llvm-080a61c21b5e2164c842cc73e33e1f4f3b41805a.zip
Clarify comment. Remove braces from single-statement block.
llvm-svn: 201040
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index dd059bbb098..b42b502b097 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -6979,11 +6979,11 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
if (!NewFD->isInvalidDecl() && !NewFD->hasAttr<WarnUnusedResultAttr>() &&
Ret && Ret->hasAttr<WarnUnusedResultAttr>()) {
const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(NewFD);
- // Attach the attribute to the new decl. Don't apply the attribute if it
- // returns an instance of the class (e.g. assignment operators).
- if (!MD || MD->getParent() != Ret) {
+ // Attach WarnUnusedResult to functions returning types with that attribute.
+ // Don't apply the attribute to that type's own non-static member functions
+ // (to avoid warning on things like assignment operators)
+ if (!MD || MD->getParent() != Ret)
NewFD->addAttr(WarnUnusedResultAttr::CreateImplicit(Context));
- }
}
if (getLangOpts().OpenCL) {
OpenPOWER on IntegriCloud