use of predefined identifiers like __func__ at global scope warn in sema,

but crashed codegen.  Fix this to report the name of the llvm function.
This fixes rdar://6808051

llvm-svn: 69658
This commit is contained in:
Chris Lattner 2009-04-21 04:41:23 +00:00
parent 92b29b2f9f
commit a9aeea9f27
2 changed files with 7 additions and 1 deletions

View File

@ -753,7 +753,7 @@ LValue CodeGenFunction::EmitPredefinedFunctionName(unsigned Type) {
}
std::string FunctionName;
if(const FunctionDecl *FD = dyn_cast<FunctionDecl>(CurFuncDecl)) {
if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(CurFuncDecl)) {
FunctionName = CGM.getMangledName(FD);
} else {
// Just get the mangled name; skipping the asm prefix if it

View File

@ -17,4 +17,10 @@ struct s0 f2(struct s0 a0) {
return ^(struct s0 a1){ return a1; }(a0);
}
// This should not crash: rdar://6808051
void *P = ^{
void *Q = __func__;
};
// RUN: true