summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-02-17 23:25:52 +0000
committerMike Stump <mrs@apple.com>2009-02-17 23:25:52 +0000
commiteecd39f2d7a731a0525ecf0aaa2b00ed498a9b03 (patch)
tree23a1b808a9494a428eb6546461e3900de427d5f0
parent491812cd76efb2c5b1697ddfaebd07b7eedad23a (diff)
downloadbcm5719-llvm-eecd39f2d7a731a0525ecf0aaa2b00ed498a9b03.tar.gz
bcm5719-llvm-eecd39f2d7a731a0525ecf0aaa2b00ed498a9b03.zip
Avoid getNameAsCString when the decl doesn't have a name.
Build of the parm list with the iterator, not end(). llvm-svn: 64851
-rw-r--r--clang/lib/CodeGen/CGBlocks.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 783606cc46a..4a940960730 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud