Allow __func__ and __FUNCTION__ and __PRETTY_FUNCTION__ inside blocks.
Radar 8218839. llvm-svn: 109272
This commit is contained in:
parent
ebb84b243b
commit
946274471d
|
@ -1856,6 +1856,8 @@ Sema::OwningExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc,
|
|||
// string.
|
||||
|
||||
Decl *currentDecl = getCurFunctionOrMethodDecl();
|
||||
if (!currentDecl && getCurBlock())
|
||||
currentDecl = getCurBlock()->TheDecl;
|
||||
if (!currentDecl) {
|
||||
Diag(Loc, diag::ext_predef_outside_function);
|
||||
currentDecl = Context.getTranslationUnitDecl();
|
||||
|
|
|
@ -221,3 +221,8 @@ void test21() {
|
|||
(void)b[1]; // expected-error {{cannot refer to declaration with an array type inside block}}
|
||||
}();
|
||||
}
|
||||
|
||||
// rdar ://8218839
|
||||
const char * (^func)(void) = ^{ return __func__; };
|
||||
const char * (^function)(void) = ^{ return __FUNCTION__; };
|
||||
const char * (^pretty)(void) = ^{ return __PRETTY_FUNCTION__; };
|
||||
|
|
Loading…
Reference in New Issue