summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/ItaniumMangle.cpp6
-rw-r--r--test/CodeGenObjCXX/mangle.mm12
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp
index 2b9fa42cf4..e81ec7e54b 100644
--- a/lib/AST/ItaniumMangle.cpp
+++ b/lib/AST/ItaniumMangle.cpp
@@ -1122,6 +1122,12 @@ void CXXNameMangler::mangleLocalName(const NamedDecl *ND) {
// := Z <function encoding> E s [<discriminator>]
// <discriminator> := _ <non-negative number>
const DeclContext *DC = ND->getDeclContext();
+ if (isa<ObjCMethodDecl>(DC) && isa<FunctionDecl>(ND)) {
+ // Don't add objc method name mangling to locally declared function
+ mangleUnqualifiedName(ND);
+ return;
+ }
+
Out << 'Z';
if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(DC)) {
diff --git a/test/CodeGenObjCXX/mangle.mm b/test/CodeGenObjCXX/mangle.mm
index 7a75a5b40e..2521c6076a 100644
--- a/test/CodeGenObjCXX/mangle.mm
+++ b/test/CodeGenObjCXX/mangle.mm
@@ -42,3 +42,15 @@
}
@end
+// rdar://9566314
+@interface NX
+- (void)Meth;
+@end
+
+@implementation NX
+- (void)Meth {
+ void uiIsVisible();
+// CHECK: call void @_Z11uiIsVisiblev
+ uiIsVisible();
+}
+@end