From: Alex Lorenz Date: Wed, 26 Apr 2017 12:46:27 +0000 (+0000) Subject: [AST] Look through attribute type locs when searching for function type X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86ab1dc77f2361290a39c03a22d411209b3add17;p=clang [AST] Look through attribute type locs when searching for function type loc Prior to this commit -Wdocumentation crashed when checking the @returns command for declarations whose function/block pointer type included an attribute like _Nullable. rdar://31818195 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301400 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Comment.cpp b/lib/AST/Comment.cpp index 20ff2430df..dfa2a1665d 100644 --- a/lib/AST/Comment.cpp +++ b/lib/AST/Comment.cpp @@ -116,6 +116,9 @@ bool ParagraphComment::isWhitespaceNoCache() const { static TypeLoc lookThroughTypedefOrTypeAliasLocs(TypeLoc &SrcTL) { TypeLoc TL = SrcTL.IgnoreParens(); + // Look through attribute types. + if (AttributedTypeLoc AttributeTL = TL.getAs()) + return AttributeTL.getModifiedLoc(); // Look through qualified types. if (QualifiedTypeLoc QualifiedTL = TL.getAs()) return QualifiedTL.getUnqualifiedLoc(); diff --git a/test/Sema/warn-documentation.m b/test/Sema/warn-documentation.m index a8538f02be..98336f9fa2 100644 --- a/test/Sema/warn-documentation.m +++ b/test/Sema/warn-documentation.m @@ -254,7 +254,7 @@ struct HasFields { * \param p not here. * \returns integer. */ -void (^blockPointerVariableThatLeadsNowhere)(); +void (^_Nullable blockPointerVariableThatLeadsNowhere)(); @interface CheckFunctionBlockPointerVars { /**