Commit Graph

30 Commits

Author SHA1 Message Date
Allan Shortlidge
f49dbb06b6 TBDGen: Specify the correct macCatalyst platform ID in $ld$previous directives.
Resolves rdar://123491072
2024-03-05 19:05:19 -08:00
Allan Shortlidge
67a24ccca5 TBDGen: Don't skip extensions on clang types.
Fixes a regression introduced with https://github.com/apple/swift/pull/68216.
Some nominal types belonging to clang modules don't have a clang node in the
AST, so make sure we match the logic used when computing IR linkage to
determine whether a nominal type is a clang type.

Resolves rdar://115308770
2023-09-11 16:13:03 -07:00
Doug Gregor
7a2c28db1a [TBD] Update test to account for iOS device vs. iOS simulator.
The test was only checking iOS, and assuming that simulator targets
would behave the same way. Make the test amenable to both iOS and
iOS simulator.
2020-04-06 16:52:56 -07:00
Xi Ge
251edf3765 TBDGen: don't emit $ld$previous$ symbols for added members to a moved decl
When a top-level decl is marked with @_originallyDefinedIn, some of its members
may also be newly added after the top-level decl has been moved to the current module.
For these members, we don't need emit $ld$previous$ symbols for them.

rdar://60478650
2020-03-15 19:02:31 -07:00
Xi Ge
3ee9b1175c TBDGen: when previous install name map is specified, emit $ld$previous linker directives.
Progress towards: rdar://58281536
2020-01-17 15:57:25 -08:00
Xi Ge
90f59e4336 TBDGen: teach the compiler to take a json file indicating previous install names
Using the new linker directives $ld$previous requires the compiler to know the previous
install names for the symbols marked as removed. This patch teaches the compiler
to take a path to a Json file specifying the map between module names and previous
install names. Also, these install names can be platform-specific.

Progress towards: rdar://58281536
2020-01-13 17:45:40 -08:00
Harlan Haskins
c94b952a54 [TBDGen] Mangle symbols before putting them in the TBD
The linker expects to see mangled symbols in the TBD, otherwise it won't
be able to link anything. Use LLVM's mangler to mangle them.

Fixes rdar://54055049
2019-10-16 18:50:54 -07:00
Huon Wilson
e952579122 [test] Add a test that combines all TBD files into a single module.
This checks that all combinations of optimized & non-optimized, and whole-module
optimization & incremental compilation give the same result, on a module where
this is actually interesting (i.e. has multiple files so the behaviour differs
between the two).
2018-08-07 09:54:35 +10:00
Huon Wilson
8937148321 [test] Stop a test from relying on the exact format of TBD files.
Fixes rdar://problem/42413326
2018-07-20 23:25:34 +10:00
Huon Wilson
2e3e6558b7 [Driver] Pass -emit-tbd through to -frontend -merge-modules, to get TBD files without -wmo.
Fixes rdar://problem/33735706
2018-07-20 08:12:22 +10:00
Huon Wilson
34a5ce9044 [TBDGen] Handle conformance witnesses correctly.
We need to be looking at the linkage of the witness, but mangling the
requirement. Also, getGetter() gets the getter, not the setter (copy-paste
strikes again).

Fixes rdar://problem/40355657.
2018-05-23 15:36:27 +10:00
Huon Wilson
4385d9042c [TBDGen] Types with resilient superclasses need special consideration for their metadata.
Fixes rdar://problem/40355432.
2018-05-21 22:45:31 +10:00
Huon Wilson
d40b8fa5e2 [TBDGen] Conformances in extensions. 2017-04-18 11:14:19 -07:00
Huon Wilson
704d4ed631 [test/TBD] Input -> Inputs. Whoops. 2017-04-18 10:45:26 -07:00
Huon Wilson
e5acdd42fc [TBDGen] Handle private/internal methods on open classes. 2017-04-14 10:13:11 -07:00
Huon Wilson
c41319b24b [SIL] Only open classes can be subclassed externally. 2017-04-14 10:13:11 -07:00
Huon Wilson
04aa385f27 [TBDGen] Non-allocating class constructor/destructor. 2017-04-13 11:42:54 -07:00
Huon Wilson
fce992ff8b [TBDGen] Class direct field offsets. 2017-04-13 11:41:29 -07:00
Huon Wilson
6cccddf39a [TBDGen] Class metaclasses, when interacting with ObjC. 2017-04-13 11:40:50 -07:00
Huon Wilson
520f186c4f [TBDGen] Class witness table offsets. 2017-04-13 11:39:50 -07:00
Huon Wilson
2446db55ed [TBDGen] Stored property initializers. 2017-04-13 11:38:58 -07:00
Huon Wilson
53d80be1e3 [TBDGen] Transparent symbols don't exist. 2017-04-13 11:36:50 -07:00
Erik Eckstein
789646a15b Demangling: Make demangled names more readable and further reduce the size of the simplified demangled names
The goal here is to make the short demangling as short and readable as possible, also at the cost of omitting some information.
The assumption is that whenever the short demangling is displayed, there is a way for the user to also get the full demangled name if needed.

*) omit <where ...> because it does not give useful information anyway

Deserializer.deserialize<A where ...> () throws -> [A]
--> Deserializer.deserialize<A> () throws -> [A]

*) for multiple specialized functions only emit a single “specialized”

specialized specialized Constructible.create(A.Element) -> Constructible<A>
--> specialized Constructible.create(A.Element) -> Constructible<A>

*) Don’t print function argument types:

foo(Int, Double, named: Int)
--> foo(_:_:named:)

This is a trade-off, because it can lead to ambiguity if there are overloads with different types.

*) make contexts of closures, local functions, etc. more readable by using “<a> in <b>” syntax
This is also done for the full and not only for the simplified demangling.

Renderer.(renderInlines([Inline]) -> String).(closure #1)
--> closure #1 in Renderer.renderInlines

*) change spacing, so that it matches our coding style:

foo <A> (x : A)
--> foo<A>(x: A)
2017-04-13 08:43:28 -07:00
Huon Wilson
088824de2b [TBDGen] Generate symbols for protocol conformances. 2017-04-06 17:51:04 -07:00
Slava Pestov
6a83e7303e SILGen: Protocol witness thunks don't need public linkage
We used to give witness thunks public linkage if the
conforming type and the protocol are public.

This is completely unnecessary. If the conformance is
fragile, the thunk should be [shared] [serialized],
allowing the thunk to be serialized into callers after
devirtualization.

Otherwise for private protocols or resilient modules,
witness thunks can just always be private.

This should reduce the size of compiled binaries.

There are two other mildly interesting consequences:

1) In the bridged cast tests, we now inline the witness
   thunks from the bridgeable conformances, which removes
   one level of indirection.

2) This uncovered a flaw in our accessibility checking
   model. Usually, we reject a witness that is less
   visible than the protocol; however, we fail to
   reject it in the case that it comes from an
   extension.

   This is because members of an extension can be
   declared 'public' even if the extended type is not
   public, and it appears that in this case the 'public'
   keyword has no effect.

   I would prefer it if a) 'public' generated a warning
   here, and b) the conformance also generated a warning.

   In Swift 4 mode, we could then make this kind of
   sillyness into an error. But for now, live with the
   broken behavior, and add a test to exercise it to ensure
   we don't crash.

   There are other places where this "allow public but
   ignore it, kinda, except respect it in some places"
   behavior causes problems. I don't know if it was intentional
   or just emergent behavior from general messiness in Sema.

3) In the TBD code, there is one less 'failure' because now
   that witness thunks are no longer public, TBDGen does not
   need to reason about them (except for the case #2 above,
   which will probably require a similar workaround in TBDGen
   as what I put into SILGen).
2017-03-30 03:52:57 -07:00
Huon Wilson
0c37685327 [TBD] Validate against truly externally visible symbols in the IR.
External linkage isn't enough: not being hidden is important too.
2017-03-28 16:31:12 -07:00
Huon Wilson
91bf6771ca [test/TBD] add tests that really use private-access. 2017-03-28 16:31:12 -07:00
Huon Wilson
d7a8b8382f [test/TBD] use "internal" instead of "private". 2017-03-28 16:31:11 -07:00
Huon Wilson
83f6e319f9 [TBD] let special casing actually applies to static/global lets and vars. 2017-03-28 16:31:11 -07:00
Huon Wilson
636a3c5821 [TBD] Sort -emit-tbd, and -validate-tbd-against-ir errors.
Also, diff the full output rather than using FileCheck.
2017-03-28 16:31:10 -07:00