Author: dgregor
Date: Fri Jun 19 18:18:03 2015
New Revision: 240189
URL: http://llvm.org/viewvc/llvm-project?rev=240189&view=rev
Log:
Stop moving attributes off of a block literal's decl specifiers.
These usually apply to the return type. At one point this was necessary to
get some of them to apply to the entire block, but it appears that's working
anyway (see block-return.c).
rdar://problem/20468034
Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/SemaObjC/nullability.m
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=240189&r1=240188&r2=240189&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Fri Jun 19 18:18:03 2015
@@ -2640,9 +2640,6 @@ void Parser::ParseBlockId(SourceLocation
Declarator DeclaratorInfo(DS, Declarator::BlockLiteralContext);
ParseDeclarator(DeclaratorInfo);
- // We do this for: ^ __attribute__((noreturn)) {, as DS has the attributes.
- DeclaratorInfo.takeAttributes(DS.getAttributes(), SourceLocation());
-
MaybeParseGNUAttributes(DeclaratorInfo);
// Inform sema that we are starting a block.
Modified: cfe/trunk/test/SemaObjC/nullability.m
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/nullability.m?rev=240189&r1=240188&r2=240189&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/nullability.m (original)
+++ cfe/trunk/test/SemaObjC/nullability.m Fri Jun 19 18:18:03 2015
@@ -222,3 +222,11 @@ void testMultiProp(MultiProp *foo) {
ip = foo.d; // expected-warning{{from 'MultiProp * __nullable'}}
ip = foo.e; // expected-error{{incompatible type 'MultiProp *(^
__nullable)(int)'}}
}
+
+void testBlockLiterals() {
+ (void)(^id(void) { return 0; });
+ (void)(^id __nullable (void) { return 0; });
+ (void)(^ __nullable id(void) { return 0; });
+
+ int *x = (^ __nullable id(void) { return 0; })(); //
expected-warning{{incompatible pointer types initializing 'int *' with an
expression of type 'id __nullable'}}
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits