@@ -31,53 +31,24 @@ void ClangClassTypePrinter::printClassTypeDecl(
31
31
os << " ;\n " ;
32
32
});
33
33
34
+ StringRef baseClassName = " RefCountedClass" ;
35
+ StringRef baseClassQualifiedName = " swift::_impl::RefCountedClass" ;
36
+
34
37
os << " class " ;
35
38
printer.printBaseName (typeDecl);
36
39
// FIXME: Add support for inherintance.
37
- os << " final" ;
40
+ os << " final : " << baseClassQualifiedName ;
38
41
os << " {\n " ;
39
42
os << " public:\n " ;
40
43
41
- // Destructor releases the object.
42
- os << " inline ~" ;
43
- printer.printBaseName (typeDecl);
44
- os << " () { swift::" << cxx_synthesis::getCxxImplNamespaceName ()
45
- << " ::swift_release(_opaquePointer); }\n " ;
46
-
47
- os << " inline " ;
48
- printer.printBaseName (typeDecl);
49
- os << " (const " ;
50
- printer.printBaseName (typeDecl);
51
- os << " & other) noexcept : _opaquePointer(other._opaquePointer) { swift::"
52
- << cxx_synthesis::getCxxImplNamespaceName ()
53
- << " ::swift_retain(_opaquePointer); }\n " ;
54
-
55
- os << " inline " ;
56
- printer.printBaseName (typeDecl);
57
- os << " & operator=(const " ;
58
- printer.printBaseName (typeDecl);
59
- os << " & other) noexcept {\n swift::"
60
- << cxx_synthesis::getCxxImplNamespaceName ()
61
- << " ::swift_retain(other._opaquePointer);\n " ;
62
- os << " swift::" << cxx_synthesis::getCxxImplNamespaceName ()
63
- << " ::swift_release(_opaquePointer);\n " ;
64
- os << " _opaquePointer = other._opaquePointer;\n " ;
65
- os << " return *this;\n " ;
66
- os << " }\n " ;
67
-
68
- // FIXME: move semantics should be restricted?
69
- os << " inline " ;
70
- printer.printBaseName (typeDecl);
71
- os << " (" ;
72
- printer.printBaseName (typeDecl);
73
- os << " &&) noexcept = default;\n " ;
44
+ os << " using " << baseClassName << " ::" << baseClassName << " ;\n " ;
45
+ os << " using " << baseClassName << " ::operator=;\n " ;
74
46
75
47
os << " private:\n " ;
76
48
os << " inline " ;
77
49
printer.printBaseName (typeDecl);
78
- os << " (void * _Nonnull ptr) noexcept : _opaquePointer(ptr) {}\n " ;
79
- os << " \n void * _Nonnull _opaquePointer;\n " ;
80
- os << " friend class " << cxx_synthesis::getCxxImplNamespaceName () << " ::" ;
50
+ os << " (void * _Nonnull ptr) noexcept : " << baseClassName << " (ptr) {}\n " ;
51
+ os << " \n friend class " << cxx_synthesis::getCxxImplNamespaceName () << " ::" ;
81
52
printCxxImplClassName (os, typeDecl);
82
53
os << " ;\n " ;
83
54
os << " };\n\n " ;
0 commit comments