r301400 - [AST] Look through attribute type locs when searching for function type
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 26 05:46:28 PDT 2017
Author: arphaman
Date: Wed Apr 26 07:46:27 2017
New Revision: 301400
URL: http://llvm.org/viewvc/llvm-project?rev=301400&view=rev
Log:
[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
Modified:
cfe/trunk/lib/AST/Comment.cpp
cfe/trunk/test/Sema/warn-documentation.m
Modified: cfe/trunk/lib/AST/Comment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Comment.cpp?rev=301400&r1=301399&r2=301400&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Comment.cpp (original)
+++ cfe/trunk/lib/AST/Comment.cpp Wed Apr 26 07:46:27 2017
@@ -116,6 +116,9 @@ bool ParagraphComment::isWhitespaceNoCac
static TypeLoc lookThroughTypedefOrTypeAliasLocs(TypeLoc &SrcTL) {
TypeLoc TL = SrcTL.IgnoreParens();
+ // Look through attribute types.
+ if (AttributedTypeLoc AttributeTL = TL.getAs<AttributedTypeLoc>())
+ return AttributeTL.getModifiedLoc();
// Look through qualified types.
if (QualifiedTypeLoc QualifiedTL = TL.getAs<QualifiedTypeLoc>())
return QualifiedTL.getUnqualifiedLoc();
Modified: cfe/trunk/test/Sema/warn-documentation.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.m?rev=301400&r1=301399&r2=301400&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation.m (original)
+++ cfe/trunk/test/Sema/warn-documentation.m Wed Apr 26 07:46:27 2017
@@ -254,7 +254,7 @@ struct HasFields {
* \param p not here.
* \returns integer.
*/
-void (^blockPointerVariableThatLeadsNowhere)();
+void (^_Nullable blockPointerVariableThatLeadsNowhere)();
@interface CheckFunctionBlockPointerVars {
/**
More information about the cfe-commits
mailing list