r201040 - Clarify comment. Remove braces from single-statement block.
David Blaikie
dblaikie at gmail.com
Sat Feb 8 23:24:41 PST 2014
Author: dblaikie
Date: Sun Feb 9 01:24:41 2014
New Revision: 201040
URL: http://llvm.org/viewvc/llvm-project?rev=201040&view=rev
Log:
Clarify comment. Remove braces from single-statement block.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=201040&r1=201039&r2=201040&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Feb 9 01:24:41 2014
@@ -6979,11 +6979,11 @@ Sema::ActOnFunctionDeclarator(Scope *S,
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) {
More information about the cfe-commits
mailing list