Sema: Introduce intrinsic pointer argument conversions.

Add primitive type-checker rules for pointer arguments. An UnsafePointer argument accepts:

- an UnsafePointer value of matching element type, or of any type if the argument is UnsafePointer<Void>,
- an inout parameter of matching element type, or of any type if the argument is UnsafePointer<Void>, or
- an inout Array parameter of matching element type, or of any type if the argument is UnsafePointer<Void>.

A ConstUnsafePointer argument accepts:

- an UnsafePointer, ConstUnsafePointer, or AutoreleasingUnsafePointer value of matching element type, or of any type if the argument is ConstUnsafePointer<Void>,
- an inout parameter of matching element type, or of any type if the argument is ConstUnsafePointer<Void>, or
- an inout or non-inout Array parameter of matching element type, or of any type if the argument is ConstUnsafePointer<Void>.

An AutoreleasingUnsafePointer argument accepts:

- an AutoreleasingUnsafePointer value of matching element type, or
- an inout parameter of matching element type.

This disrupts some error messages in unrelated tests, which is tracked by <rdar://problem/17380520>.

Swift SVN r19008
This commit is contained in:
Joe Groff
2014-06-19 18:03:10 +00:00
parent 63e34d727c
commit 08a48565fb
21 changed files with 549 additions and 8 deletions

View File

@@ -536,6 +536,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.EnableExperimentalPatterns |= Args.hasArg(OPT_enable_experimental_patterns);
Opts.EnablePointerConversions |= Args.hasArg(OPT_enable_pointer_conversions);
Opts.EnableCharacterLiterals |= Args.hasArg(OPT_enable_character_literals);
Opts.DebugConstraintSolver |= Args.hasArg(OPT_debug_constraints);