summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp4
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 3dfb1821cc0..e750d8a8d5b 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -236,8 +236,8 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
const llvm::Type *LTy = ConvertTypeForMem(Ty);
if (isByRef)
LTy = BuildByRefType(Ty, getContext().getDeclAlignInBytes(&D));
- llvm::AllocaInst *Alloc =
- CreateTempAlloca(LTy, CGM.getMangledName(&D));
+ llvm::AllocaInst *Alloc =
+ CreateTempAlloca(LTy, D.getNameAsString().c_str());
if (isByRef)
Alloc->setAlignment(std::max(getContext().getDeclAlignInBytes(&D),
getContext().getTypeAlign(getContext().VoidPtrTy) / 8));
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index a187f8a51bb..3f930feaaa0 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -170,8 +170,10 @@ static void setGlobalVisibility(llvm::GlobalValue *GV,
const char *CodeGenModule::getMangledName(const NamedDecl *ND) {
llvm::SmallString<256> Name;
llvm::raw_svector_ostream Out(Name);
- if (!mangleName(ND, Context, Out))
+ if (!mangleName(ND, Context, Out)) {
+ assert(ND->getIdentifier() && "Attempt to mangle unnamed decl.");
return ND->getIdentifier()->getName();
+ }
Name += '\0';
return MangledNames.GetOrCreateValue(Name.begin(), Name.end())
OpenPOWER on IntegriCloud