]> granicus.if.org Git - clang/commitdiff
Objective-C++ ARC: do not mangle __unsafe_unretained lifetime
authorDouglas Gregor <dgregor@apple.com>
Fri, 17 Jun 2011 22:26:49 +0000 (22:26 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 17 Jun 2011 22:26:49 +0000 (22:26 +0000)
qualifiers, so that an __unsafe_unretained-qualified type T in ARC code
will have the same mangling as T in non-ARC code, improving ABI
interoperability. This works now because we infer or require a
lifetime qualifier everywhere one can appear in an external
interface. Another part of <rdar://problem/9595486>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133306 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ItaniumMangle.cpp
test/CodeGenObjCXX/arc-mangle.mm

index a77fe5f48ab1cfef3e72c78c8af60aa62d2a6495..5f0b2a6eff82b5d8f2503312256a48c461ccc39c 100644 (file)
@@ -1472,7 +1472,6 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals) {
   //   <type> ::= U "__strong"
   //   <type> ::= U "__weak"
   //   <type> ::= U "__autoreleasing"
-  //   <type> ::= U "__unsafe_unretained"
   case Qualifiers::OCL_None:
     break;
     
@@ -1489,7 +1488,13 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals) {
     break;
     
   case Qualifiers::OCL_ExplicitNone:
-    LifetimeName = "__unsafe_unretained";
+    // The __unsafe_unretained qualifier is *not* mangled, so that
+    // __unsafe_unretained types in ARC produce the same manglings as the
+    // equivalent (but, naturally, unqualified) types in non-ARC, providing
+    // better ABI compatibility.
+    //
+    // It's safe to do this because unqualified 'id' won't show up
+    // in any type signatures that need to be mangled.
     break;
   }
   if (!LifetimeName.empty())
index 628144f04c1c72cd905587a86320796afee165c5..20af4dfccae493d463fae82b870bb79c3a6efd79 100644 (file)
@@ -6,7 +6,7 @@ void f(__strong id *) {}
 void f(__weak id *) {}
 // CHECK: define void @_Z1fPU15__autoreleasingP11objc_object(i8**)
 void f(__autoreleasing id *) {}
-// CHECK: define void @_Z1fPU19__unsafe_unretainedP11objc_object(i8**)
+// CHECK: define void @_Z1fPP11objc_object(i8**)
 void f(__unsafe_unretained id *) {}
 // CHECK: define void @_Z1fPKU8__strongP11objc_object(i8**)
 void f(const __strong id *) {}
@@ -14,7 +14,7 @@ void f(const __strong id *) {}
 void f(const __weak id *) {}
 // CHECK: define void @_Z1fPKU15__autoreleasingP11objc_object(i8**)
 void f(const __autoreleasing id *) {}
-// CHECK: define void @_Z1fPKU19__unsafe_unretainedP11objc_object(i8**)
+// CHECK: define void @_Z1fPKP11objc_object(i8**)
 void f(const __unsafe_unretained id *) {}