Start emitting .cxx_construct methods for Objective-C-derived classes.

When we're using Objective-C's memory allocation, emit .cxx_construct
methods whenever we have instance variables with in-class
initializers. Presently, these methods are just empty stubs.

Swift SVN r12211
This commit is contained in:
Doug Gregor
2014-01-12 04:31:52 +00:00
parent 804a23e32f
commit fc7dfb2fae
19 changed files with 131 additions and 27 deletions

View File

@@ -96,8 +96,8 @@ SILDeclRef::SILDeclRef(ValueDecl *vd, SILDeclRef::Kind kind,
&& "can only create destroyer/deallocator SILDeclRef for dtor");
naturalUncurryLevel = 0;
} else if (isa<ClassDecl>(vd)) {
assert(kind == Kind::IVarDestroyer
&& "can only create ivar destroyer SILDeclRef for class decl");
assert((kind == Kind::IVarInitializer || kind == Kind::IVarDestroyer)
&& "can only create ivar initializer/destroyer SILDeclRef for class");
naturalUncurryLevel = 1;
} else if (auto *var = dyn_cast<VarDecl>(vd)) {
assert((kind == Kind::Getter
@@ -363,10 +363,14 @@ static void mangleConstant(SILDeclRef c, llvm::raw_ostream &buffer) {
c.uncurryLevel);
return;
// entity ::= declaration 'e' // ivar initializer
// entity ::= declaration 'E' // ivar destroyer
case SILDeclRef::Kind::IVarInitializer:
case SILDeclRef::Kind::IVarDestroyer:
buffer << introducer;
mangler.mangleIVarDestroyerEntity(cast<ClassDecl>(c.getDecl()));
mangler.mangleIVarInitDestroyEntity(
cast<ClassDecl>(c.getDecl()),
c.kind == SILDeclRef::Kind::IVarDestroyer);
return;
// entity ::= declaration 'g' // getter