summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp4
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
-rw-r--r--clang/test/Coverage/objc-language-features.inc8
3 files changed, 13 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())
diff --git a/clang/test/Coverage/objc-language-features.inc b/clang/test/Coverage/objc-language-features.inc
index 25988f5e53a..3b092ffbf4c 100644
--- a/clang/test/Coverage/objc-language-features.inc
+++ b/clang/test/Coverage/objc-language-features.inc
@@ -51,6 +51,9 @@
@implementation A (Cat)
@end
+@interface B
+@end
+
int f0(id x) {
#ifndef IRGENABLE_GNU
#ifndef IRGENABLE
@@ -62,8 +65,13 @@ int f0(id x) {
#ifndef IRGENABLE_GNU
@try {
@throw x;
+
} @catch(A *e) {
@throw;
+
+ // @catch param doesn't require name.
+ } @catch(B *) {
+
} @finally {
;
}
OpenPOWER on IntegriCloud