Commit Graph

20 Commits

Author SHA1 Message Date
Jordan Rose
9647483aee Warn when using '@_implementationOnly' inconsistently in a module (#24800)
I thought it would be useful to allow some uses of a module to be
'@_implementationOnly' and others to not be in case someone wanted to
change from one to the other gradually, but it turns out that if
you're trying to /make/ an import implementation-only, you want to
know everywhere you used it.

rdar://problem/50748157
2019-05-16 09:13:34 -07:00
Joe Groff
cec9e9e33a Opaque types require a newer Swift runtime.
Check the availability of decls that declare an opaque return type to ensure they deploy to a
runtime that supports opaque types.

rdar://problem/50731151
2019-05-15 11:39:53 -07:00
Saleem Abdulrasool
a6ff2538a7 test: make portable to LLP64 targets (harder)
`Int` is not usable for LLP64 targets, use an explicit `Int32` when
bridging an ObjC enumeration.
2019-05-06 08:32:34 -07:00
Saleem Abdulrasool
7701b88307 test: make portable to LLP64 targets
`Int` is not usable for LLP64 targets, use an explicit `Int32` when
bridging an ObjC enumeration.
2019-05-05 10:53:00 -07:00
Jordan Rose
9ba1d8a1c6 [ModuleInterface] Include the raw values of @objc enums (#24487)
...since they're part of the run-time representation. Not having this
meant that someone compiling against an interface would miscompile
uses of @objc enums defined in that interface!

rdar://problem/50410541
2019-05-04 10:14:46 -07:00
Joe Groff
dbd3a48afb Track var/subscript opaque return decls for type reconstruction. 2019-04-17 14:46:22 -07:00
Joe Groff
399332b75b Parsable interface and type reconstruction support for opaque types.
When printing a swiftinterface, represent opaque result types using an attribute that refers to
the mangled name of the defining decl for the opaque type. To turn this back into a reference
to the right decl's implicit OpaqueTypeDecl, use type reconstruction. Since type reconstruction
doesn't normally concern itself with non-type decls, set up a lookup table in SourceFiles and
ModuleFiles to let us handle the mapping from mangled name to opaque type decl in type
reconstruction.

(Since we're invoking type reconstruction during type checking, when the module hasn't yet been
fully validated, we need to plumb a LazyResolver into the ASTBuilder in an unsightly way. Maybe
there's a better way to do this... Longer term, at least, this surface design gives space for
doing things more the right way--a more request-ified decl validator ought to be able to naturally
lazily service this request without the LazyResolver reference, and if type reconstruction in
the future learns how to reconstruct non-type decls, then the lookup tables can go away.)
2019-04-17 14:46:22 -07:00
Daniel Rodríguez Troitiño
ed3c03ac4f [windows] Fix handling of Network Service username.
In Windows Server 2016 at least, the Network Service user (the one being
used by the CI machine) is returned as Host$, which icacls doesn't
understand. Turn the name into something that icacls if we get a name
that ends with a dollar.
2019-04-01 18:03:46 -07:00
Saleem Abdulrasool
7c078bf486 test: make the ParseableInterface.ModuleCache tests pass on Windows
Use a wrapper for invoking chmod a-r or icacls on Windows to make the
files actually unreadable.  This allows the tests to pass on Windows.
2019-04-01 09:58:20 -07:00
Jordan Rose
0ba6c495ba Add @_implementationOnly
This is an attribute that gets put on an import in library FooKit to
keep it from being a requirement to import FooKit. It's not checked at
all, meaning that in this form it is up to the author of FooKit to
make sure nothing in its API or ABI depends on the implementation-only
dependency. There's also no debugging support here (debugging FooKit
/should/ import the implementation-only dependency if it's present).

The goal is to get to a point where it /can/ be checked, i.e. FooKit
developers are prevented from writing code that would rely on FooKit's
implementation-only dependency being present when compiling clients of
FooKit. But right now it's not.

rdar://problem/48985979
2019-03-28 15:57:53 -07:00
Saleem Abdulrasool
8e5e32b5d8 test: use #include rather than #import
`#import` is an extension which behaves differently in different target.  On
Windows, it is used to import type libraries (for COM).  The options are to
either use `#include` or enable Objective-C interop.  Use the former since there
is no Objective-C specific behaviour needed here.
2019-03-22 09:50:03 -07:00
Jordan Rose
0366343681 [ParseableInterface] Honor "exported module names"
(as described in the previous commit)

When printing an interface that has to be stable, we need to use the
module name that identifies where declarations should be searched for,
just like we do with serialization.

rdar://problem/49114811
2019-03-21 15:22:17 -07:00
Harlan Haskins
717532ec67 [ParseableInterface] Test that module-link-name is serialized and used 2018-11-27 18:06:28 -08:00
Jordan Rose
81bcf9d5d6 Revert "[ParseableInterfaces] Skip value witnesses of resilient conformances" (#20637)
This reverts commit 61dd307b3b,
the effective part of #20419.

rdar://problem/43824088
2018-11-16 11:21:14 -08:00
Graydon Hoare
4a4f5de511 [ModuleInterface] Move module cache tests to ModuleCache subdir. 2018-11-13 13:24:23 -08:00
Jordan Rose
25d380c3e2 [test] @objc optional should always use a dynamic dispatch (#20487)
Right now we're not being careful about 'optional' in witness tables
for parseable interfaces; we're listing the requirement as the
implementation even if the requirement is optional. As long as we
don't optimize based on that information, though, we should be okay.
2018-11-12 08:25:27 -08:00
Jordan Rose
61dd307b3b [ParseableInterfaces] Skip value witnesses of resilient conformances
We can't devirtualize through these conformances anyway, so we can get
a (probably tiny) speedup by not doing any resolution of non-type
witnesses.

rdar://problem/43824088
2018-11-09 09:05:07 -08:00
Graydon Hoare
edb7ccb309 [ModuleInterface] Fix python flake8 lints. 2018-11-05 17:55:24 -08:00
Graydon Hoare
c82e76bb08 [ModuleInterface] Overhaul module-cache tests for clarity, independence. 2018-11-02 11:45:15 -07:00
Jordan Rose
73d5ebaad2 Rename "textual interface" to "parseable interface" (#19713)
We already have something called "module interfaces" -- it's the
generated interface view that you can see in Xcode, the interface
that's meant for developers using a library. Of course, that's also a
textual format. To reduce confusion, rename the new module stability
feature to "parseable [module] interfaces".
2018-10-04 17:49:55 -07:00