From 1fc841b28c4c3f76d520523601dc8589396596c7 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Sun, 9 Feb 2014 07:24:41 +0000 Subject: [PATCH] Clarify comment. Remove braces from single-statement block. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201040 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index dd059bbb09..b42b502b09 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -6979,11 +6979,11 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (!NewFD->isInvalidDecl() && !NewFD->hasAttr() && Ret && Ret->hasAttr()) { const CXXMethodDecl *MD = dyn_cast(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) { -- 2.40.0