summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-04-26 12:46:27 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-04-26 12:46:27 +0000
commit6246cc6c0ebbb95eb74ffdbc2004b7d0f83c74da (patch)
treec2d32904ff938cfcd4d6e96236d4f370dfef2cee /clang
parentad06391ca98085a5245ac2fec6cccae23d3a1089 (diff)
downloadbcm5719-llvm-6246cc6c0ebbb95eb74ffdbc2004b7d0f83c74da.tar.gz
bcm5719-llvm-6246cc6c0ebbb95eb74ffdbc2004b7d0f83c74da.zip
[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 llvm-svn: 301400
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/Comment.cpp3
-rw-r--r--clang/test/Sema/warn-documentation.m2
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/AST/Comment.cpp b/clang/lib/AST/Comment.cpp
index 20ff2430df2..dfa2a1665d4 100644
--- a/clang/lib/AST/Comment.cpp
+++ b/clang/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<AttributedTypeLoc>())
+ return AttributeTL.getModifiedLoc();
// Look through qualified types.
if (QualifiedTypeLoc QualifiedTL = TL.getAs<QualifiedTypeLoc>())
return QualifiedTL.getUnqualifiedLoc();
diff --git a/clang/test/Sema/warn-documentation.m b/clang/test/Sema/warn-documentation.m
index a8538f02be1..98336f9fa28 100644
--- a/clang/test/Sema/warn-documentation.m
+++ b/clang/test/Sema/warn-documentation.m
@@ -254,7 +254,7 @@ struct HasFields {
* \param p not here.
* \returns integer.
*/
-void (^blockPointerVariableThatLeadsNowhere)();
+void (^_Nullable blockPointerVariableThatLeadsNowhere)();
@interface CheckFunctionBlockPointerVars {
/**
OpenPOWER on IntegriCloud