Import Objective-C properties marked weak/copy as weak/@NSCopying.

...and 'assign' and 'unsafe_unretained' as 'unowned(unsafe)', if the
property is a class type.

This isn't important for the compiler, but it is documentation for users
when they look at the generated interface for an Objective-C module.

Note that this actually produces a decl users can't yet write:

  unowned(unsafe) var foo: UIView!

That's <rdar://problem/17277899> unowned pointers can't be optional.

<rdar://problem/17245555>

Swift SVN r20433
This commit is contained in:
Jordan Rose
2014-07-23 22:29:01 +00:00
parent a2af37a19b
commit 00b6a5cb08
13 changed files with 151 additions and 43 deletions

View File

@@ -322,8 +322,7 @@ void SILType::print(raw_ostream &OS) const {
}
// Print other types as their Swift representation.
PrintOptions SubPrinter;
SubPrinter.PrintForSIL = true;
PrintOptions SubPrinter = PrintOptions::printSIL();
getSwiftRValueType().print(OS, SubPrinter);
}
@@ -605,8 +604,7 @@ public:
if (Subs.empty())
return;
PrintOptions SubPrinter;
SubPrinter.PrintForSIL = true;
PrintOptions SubPrinter = PrintOptions::printSIL();
OS << '<';
interleave(Subs,
[&](const Substitution &s) {
@@ -1330,7 +1328,7 @@ void SILFunction::print(llvm::raw_ostream &OS, bool Verbose) const {
// Print the type by substituting our context parameters for the dependent
// parameters.
{
PrintOptions withContextGenericParams;
PrintOptions withContextGenericParams = PrintOptions::printSIL();
withContextGenericParams.ContextGenericParams = ContextGenericParams;
LoweredType->print(OS, withContextGenericParams);
}
@@ -1359,7 +1357,7 @@ void SILGlobalVariable::print(llvm::raw_ostream &OS, bool Verbose) const {
printName(OS);
OS << " : " << LoweredType;
OS << "\n\n";
}
@@ -1492,14 +1490,13 @@ void SILModule::print(llvm::raw_ostream &OS, bool Verbose,
// Print the declarations and types from the origin module.
if (M) {
PrintOptions Options;
Options.FunctionDefinitions = false;
PrintOptions Options = PrintOptions::printSIL();
Options.TypeDefinitions = true;
Options.VarInitializers = true;
Options.SkipImplicit = false;
// FIXME: ExplodePatternBindingDecls is incompatible with VarInitializers!
Options.ExplodePatternBindingDecls = true;
Options.SkipImplicit = false;
Options.PrintGetSetOnRWProperties = true;
Options.PrintForSIL = true;
SmallVector<Decl *, 32> topLevelDecls;
M->getTopLevelDecls(topLevelDecls);
@@ -1576,7 +1573,7 @@ void SILWitnessTable::print(llvm::raw_ostream &OS, bool Verbose) const {
auto &assocWitness = witness.getAssociatedTypeWitness();
OS << "associated_type ";
OS << assocWitness.Requirement->getName() << ": ";
assocWitness.Witness->print(OS);
assocWitness.Witness->print(OS, PrintOptions::printSIL());
break;
}
case AssociatedTypeProtocol: {