]> granicus.if.org Git - clang/commitdiff
[AST] Look through attribute type locs when searching for function type
authorAlex Lorenz <arphaman@gmail.com>
Wed, 26 Apr 2017 12:46:27 +0000 (12:46 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 26 Apr 2017 12:46:27 +0000 (12:46 +0000)
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

lib/AST/Comment.cpp
test/Sema/warn-documentation.m

index 20ff2430df2e826252e91011f130f35579645271..dfa2a1665d40fd15f8cf6b1ca3962315e88eb40e 100644 (file)
@@ -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();
index a8538f02be1bd6f749e77772d761b427d7a5c283..98336f9fa283527b24167ddbc7ba1bd9a39bc7a3 100644 (file)
@@ -254,7 +254,7 @@ struct HasFields {
  * \param p not here.
  * \returns integer.
  */
-void (^blockPointerVariableThatLeadsNowhere)();
+void (^_Nullable blockPointerVariableThatLeadsNowhere)();
 
 @interface CheckFunctionBlockPointerVars {
   /**