diff options
author | Mike Stump <mrs@apple.com> | 2009-02-17 23:25:52 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-02-17 23:25:52 +0000 |
commit | 190506199ebbfe9bf33c1b4410c7aecd7f348ab1 (patch) | |
tree | 42ba10783171a5c311f64e15e80bfbd8a21f3a41 /lib/CodeGen/CGBlocks.cpp | |
parent | c87a282e7b80c055088fc51bdbe8fc73da64d4f8 (diff) |
Avoid getNameAsCString when the decl doesn't have a name.
Build of the parm list with the iterator, not end().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64851 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | lib/CodeGen/CGBlocks.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index 783606cc46..4a94096073 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -149,7 +149,8 @@ llvm::Constant *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) { // __FuncPtr const char *Name = ""; if (const NamedDecl *ND = dyn_cast<NamedDecl>(CurFuncDecl)) - Name = ND->getNameAsCString(); + if (ND->getIdentifier()) + Name = ND->getNameAsCString(); BlockInfo Info(0, Name); llvm::Function *Fn = CodeGenFunction(*this).GenerateBlockFunction(BE, Info); Elts.push_back(Fn); @@ -371,7 +372,7 @@ llvm::Function *CodeGenFunction::GenerateBlockFunction(const BlockExpr *Expr, for (BlockDecl::param_iterator i = BD->param_begin(), e = BD->param_end(); i != e; ++i) - Args.push_back(std::make_pair(*e, (*e)->getType())); + Args.push_back(std::make_pair(*i, (*i)->getType())); const CGFunctionInfo &FI = CGM.getTypes().getFunctionInfo(FTy->getResultType(), Args); |