This revision was automatically updated to reflect the committed changes.
Closed by commit rL291231: [ObjC] The declarator for a block literal should be
a definition (authored by arphaman).
Changed prior to commit:
https://reviews.llvm.org/D28296?vs=83061&id=83355#toc
Repository:
rL LLVM
https://reviews.llvm.org/D28296
Files:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/Sema/warn-strict-prototypes.m
cfe/trunk/test/SemaObjC/block-omitted-return-type.m
Index: cfe/trunk/test/Sema/warn-strict-prototypes.m
===================================================================
--- cfe/trunk/test/Sema/warn-strict-prototypes.m
+++ cfe/trunk/test/Sema/warn-strict-prototypes.m
@@ -14,7 +14,8 @@
void (^block)() = // expected-warning {{this function declaration is not a
prototype}}
^void(int arg) { // no warning
};
- void (^block2)(void) = // no warning
- ^void() { // expected-warning {{this function
declaration is not a prototype}}
+ void (^block2)(void) = ^void() { // no warning
+ };
+ void (^block3)(void) = ^ { // no warning
};
}
Index: cfe/trunk/test/SemaObjC/block-omitted-return-type.m
===================================================================
--- cfe/trunk/test/SemaObjC/block-omitted-return-type.m
+++ cfe/trunk/test/SemaObjC/block-omitted-return-type.m
@@ -24,7 +24,7 @@
return;
};
void (^simpleBlock5)() = ^ const void { //expected-error {{incompatible
block pointer types initializing 'void (^)()' with an expression of type 'const
void (^)(void)'}}
- return;
+ return; // expected-warning@-1 {{function cannot return qualified void
type 'const void'}}
};
void (^simpleBlock6)() = ^ const (void) { //expected-warning {{'const'
qualifier on omitted return type '<dependent type>' has no effect}}
return;
Index: cfe/trunk/lib/Parse/ParseExpr.cpp
===================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp
+++ cfe/trunk/lib/Parse/ParseExpr.cpp
@@ -2751,6 +2751,7 @@
// Parse the block-declarator.
Declarator DeclaratorInfo(DS, Declarator::BlockLiteralContext);
+ DeclaratorInfo.setFunctionDefinitionKind(FDK_Definition);
ParseDeclarator(DeclaratorInfo);
MaybeParseGNUAttributes(DeclaratorInfo);
@@ -2789,6 +2790,7 @@
// Parse the return type if present.
DeclSpec DS(AttrFactory);
Declarator ParamInfo(DS, Declarator::BlockLiteralContext);
+ ParamInfo.setFunctionDefinitionKind(FDK_Definition);
// FIXME: Since the return type isn't actually parsed, it can't be used to
// fill ParamInfo with an initial valid range, so do it manually.
ParamInfo.SetSourceRange(SourceRange(Tok.getLocation(), Tok.getLocation()));
Index: cfe/trunk/test/Sema/warn-strict-prototypes.m
===================================================================
--- cfe/trunk/test/Sema/warn-strict-prototypes.m
+++ cfe/trunk/test/Sema/warn-strict-prototypes.m
@@ -14,7 +14,8 @@
void (^block)() = // expected-warning {{this function declaration is not a prototype}}
^void(int arg) { // no warning
};
- void (^block2)(void) = // no warning
- ^void() { // expected-warning {{this function declaration is not a prototype}}
+ void (^block2)(void) = ^void() { // no warning
+ };
+ void (^block3)(void) = ^ { // no warning
};
}
Index: cfe/trunk/test/SemaObjC/block-omitted-return-type.m
===================================================================
--- cfe/trunk/test/SemaObjC/block-omitted-return-type.m
+++ cfe/trunk/test/SemaObjC/block-omitted-return-type.m
@@ -24,7 +24,7 @@
return;
};
void (^simpleBlock5)() = ^ const void { //expected-error {{incompatible block pointer types initializing 'void (^)()' with an expression of type 'const void (^)(void)'}}
- return;
+ return; // expected-warning@-1 {{function cannot return qualified void type 'const void'}}
};
void (^simpleBlock6)() = ^ const (void) { //expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}}
return;
Index: cfe/trunk/lib/Parse/ParseExpr.cpp
===================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp
+++ cfe/trunk/lib/Parse/ParseExpr.cpp
@@ -2751,6 +2751,7 @@
// Parse the block-declarator.
Declarator DeclaratorInfo(DS, Declarator::BlockLiteralContext);
+ DeclaratorInfo.setFunctionDefinitionKind(FDK_Definition);
ParseDeclarator(DeclaratorInfo);
MaybeParseGNUAttributes(DeclaratorInfo);
@@ -2789,6 +2790,7 @@
// Parse the return type if present.
DeclSpec DS(AttrFactory);
Declarator ParamInfo(DS, Declarator::BlockLiteralContext);
+ ParamInfo.setFunctionDefinitionKind(FDK_Definition);
// FIXME: Since the return type isn't actually parsed, it can't be used to
// fill ParamInfo with an initial valid range, so do it manually.
ParamInfo.SetSourceRange(SourceRange(Tok.getLocation(), Tok.getLocation()));
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits