diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-04-21 04:41:23 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-04-21 04:41:23 +0000 | 
| commit | a9aeea9f275feb39a34c6c2f28d963bb751e17fe (patch) | |
| tree | 00f541a2a76737ecd508cc2c7e8f918c29f5baff /clang | |
| parent | 92b29b2f9ff225553c9719ae045f961addd15179 (diff) | |
| download | bcm5719-llvm-a9aeea9f275feb39a34c6c2f28d963bb751e17fe.tar.gz bcm5719-llvm-a9aeea9f275feb39a34c6c2f28d963bb751e17fe.zip  | |
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
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 2 | ||||
| -rw-r--r-- | clang/test/CodeGen/blocks.c | 6 | 
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 906a1e2cd6c..3ca625cc726 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -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 diff --git a/clang/test/CodeGen/blocks.c b/clang/test/CodeGen/blocks.c index 4203fce051d..c7fe3a91d25 100644 --- a/clang/test/CodeGen/blocks.c +++ b/clang/test/CodeGen/blocks.c @@ -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  | 

