[ObjC] Fix function signature handling for blocks literals with attributes
authorAlex Lorenz <arphaman@gmail.com>
Wed, 8 Nov 2017 22:44:34 +0000 (22:44 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 8 Nov 2017 22:44:34 +0000 (22:44 +0000)
commit1ee711633dfdd1fe4e94926723c92ec25ebab9f5
tree86caa6ef704568e5bd44b2a9133293f0af8d8334
parent2fd314e2e2e6193722ba5ef4b6b01ae40feeb1fe
[ObjC] Fix function signature handling for blocks literals with attributes

Block literals can have a type with attributes in its signature, e.g.
ns_returns_retained. The code that inspected the type loc of the block when
declaring its parameters didn't account for this fact, and only looked through
paren type loc. This commit ensures that getAsAdjusted is used instead of
IgnoreParens to find the block's FunctionProtoTypeLoc. This ensures that
block parameters are declared correctly in the block and avoids the
'undeclared identifier' error.

rdar://35416160

llvm-svn: 317736
clang/lib/Sema/SemaExpr.cpp
clang/test/SemaObjC/block-literal-with-attribute.m [new file with mode: 0644]