Commit Graph

384 Commits

Author SHA1 Message Date
Erik Eckstein
d342041420 Mangling: use ‘Tm’ mangling for merged functions
Previously merged functions just got the name with a “_merged” suffix
2017-05-24 17:00:16 -07:00
Erik Eckstein
cb4564ecd0 Demangler: replace an assert with a bail-condition.
The assert condition can be false for a malformed symbol, like _T0s30ReversedRandomAccessCollectionVyxGTfq3nnpf_nTfq1cn_nTfq4x_n

rdar://problem/32359287
2017-05-23 15:58:51 -07:00
Erik Eckstein
e8ce388651 Demangler: fix a hang in case a malformed symbol ends with an 'A<digit>'
For example _T0A8

rdar://problem/32359287
2017-05-23 13:53:24 -07:00
Erik Eckstein
ff892f9e19 Demangler: don’t crash if demangling a malformed KeyPath[GS]etterThunkHelper
rdar://problem/32333373
2017-05-22 16:50:26 -07:00
Erik Eckstein
4efdcebf80 Demangler: make the demangler more tolerant with malformed symbols.
Instead of crashing it just should not demangle malformed symbols.

rdar://problem/32113006
2017-05-16 12:28:32 -07:00
Joe Groff
69a7ef6e2d Revert "SILGen: Tweak key path computed property lowering to produce a consistent runtime-callable ABI."
This reverts commit 4522cd09aa. This was a failed approach I shouldn't have committed. Fixes rdar://problem/32201589.
2017-05-15 16:10:55 -07:00
Jordan Rose
c8d3506e55 Revert "[Mangling] Uniformly use "So" for imported decls." (#9233)
This reverts commit 25985cb764. For now,
we're trying to avoid spurious non-structural changes to the mangling,
so that the /old/ mangling doesn't appear to change. That doesn't mean
no changes at all, but we can save this one for later.
2017-05-03 16:13:29 -07:00
Joe Shajrawi
0d0cac357a retain_value_addr and release_value_addr SIL instructions: take as an input an address, load the value inside it and call retain_value and release_value respectively 2017-04-30 10:23:55 -07:00
Joe Shajrawi
d17258cac7 @in_constant calling convention - part of passing large loadable types by address 2017-04-30 10:13:02 -07:00
Jordan Rose
25985cb764 [Mangling] Uniformly use "So" for imported decls.
...and repurpose "SC" for (C)lang-importer-synthesized decls, instead
of just decls that are C-like instead of ObjC-like. (See next commits.)
2017-04-24 09:57:30 -07:00
Joe Groff
3d178be169 Merge pull request #8875 from jckarter/keypaths
Keypaths
2017-04-21 17:51:17 -07:00
practicalswift
431e5a1440 [gardening] Use consistent end of namespace comments 2017-04-20 13:47:10 +02:00
Joe Groff
595e0e4ede Merge branch 'master' into keypaths 2017-04-19 18:38:24 -07:00
Joe Groff
4522cd09aa SILGen: Tweak key path computed property lowering to produce a consistent runtime-callable ABI. 2017-04-18 11:44:39 -07:00
Jordan Rose
2d84981fc2 Improve the mangling of typealiases.
- Allow them to use substitutions.
- Consistently use 'a' as a mangling operator.
- For generic typealiases, include the alias as context for any generic
  parameters.

Typealiases don't show up in symbol names, which always refer to
canonical types, but they are mangled for debug info and for USRs
(unique identifiers used by SourceKit), so it's good to get this
right.
2017-04-17 11:31:15 -07:00
Jordan Rose
5de0a39f62 [Mangler] Verify USR manglings as well. 2017-04-17 11:31:15 -07:00
Joe Groff
ee66ff35c5 SILGen: Lower computed property key path components. 2017-04-14 17:13:38 -07:00
Jordan Rose
7c73ba5fe3 If a function has an error type, mangle it as '(Error) -> Error'.
This lets the mangling preserve the invariant that functions always
structurally have function types. Error types don't show up in mangled
names often anyway, but it can occur when you ask for the USR of a
function with an invalid type.
2017-04-14 17:02:54 -07:00
Slava Pestov
0d0dc207c0 AST: Mangling for primitive AnyObject
A protocol composition with an explicit 'AnyObject' member is
now mangled as <protocol list> 'Xl'. For subclass existentials,
I changed the mangling from <protocol list> <class> 'XE' to
<protocol list> <class> 'Xl'.

Not used for anything just yet.
2017-04-13 21:17:07 -07:00
Huon Wilson
22c9e20a9d [IRGen] Completely remove witness table offsets.
These are unused.
2017-04-13 11:44:01 -07:00
Slava Pestov
b5ae8c4de6 AST: Add mangling for class-constrained existentials 2017-04-12 00:07:29 -07:00
Erik Eckstein
3ee9c88166 Demangler: fix de- and re-mangling of constrained extensions
SR-4512
rdar://problem/31471429
2017-04-06 16:07:13 -07:00
Erik Eckstein
e427ded6c9 Mangling: refactoring: clean up tuple nodes
Replace VariadicTuple and NonVariadicTuple with a single Tuple node.
The variadic property is now part of the tuple element and not of the whole tuple.
2017-03-25 19:07:52 -07:00
Erik Eckstein
327017a65b Mangling: support mangling of varargs even if it's not the last argument.
Example:
func a(arr: Int..., n: String)

fixes SR-1076
2017-03-25 19:07:52 -07:00
Slava Pestov
e912f27944 AST/SILGen: New mangling for vtable thunks
Simply mangling the derived method is no longer sufficient. Now also
mangle the base method, so that eventually we handle this sort of
scenario:

class Base {
  // introduces: Base.method
  func method(_: Int, _: Int) {}
}

class First : Base {
  // overrides: Base.method
  // introduces: First.method
  override func method(_: Int?, _: Int) {}
}

class Second : First {
  // overrides: Base.method, First.method
  // introduces: Second.method
  override func method(_: Int?, _: Int?) {}
}

Here, the override of Base.method by Second.method and the
override of First.method by Second.method require distinct
manglings even though the derived method (Second.method) is
the same in both cases.

Note that while the new mangling is longer, vtable thunks are
always emitted with private linkage, so with the exception of
the standard library which is built with -sil-serialize-all
they will not affect the size of dylibs.

The standard library itself has very few classes so it doesn't
matter there either.

This patch doesn't actually add any support to introduce new
vtable entries for methods that override; this is coming up
next.
2017-03-23 23:40:52 -07:00
Roman Levenstein
e7503b1502 [mangling] Define a mangling for _Class and _NativeClass layout constraints
I forgot to define the mangling when I introduced these two new layout constraints.
2017-03-22 23:36:40 -07:00
Erik Eckstein
160d268991 mangling: Correctly demangle + remangle extensions of generic types.
fixes rdar://problem/31181011
2017-03-22 10:39:53 -07:00
Erik Eckstein
d70bfc5de2 rename namespace NewMangling -> Mangle 2017-03-20 10:09:30 -07:00
Erik Eckstein
2fbbef2fb4 Mangling: drop the support of mangling a function specialization argument which is an old-mangled function 2017-03-17 16:10:36 -07:00
Erik Eckstein
aa8cc0a539 demangler: fix a crash when trying to demangle a non-swift symbol
rdar://problem/30982254
2017-03-10 15:36:40 -08:00
Erik Eckstein
e463e69c33 demangler: Don’t emit an empty string with “with suffix ...” if the full name could not be demangled
Instead just emit the original name
2017-03-10 15:36:40 -08:00
Erik Eckstein
5e80555c9b demangler: put the demangler into a separate library
Previously it was part of swiftBasic.

The demangler library does not depend on llvm (except some header-only utilities like StringRef). Putting it into its own library makes sure that no llvm stuff will be linked into clients which use the demangler library.

This change also contains other refactoring, like moving demangler code into different files. This makes it easier to remove the old demangler from the runtime library when we switch to the new symbol mangling.

Also in this commit: remove some unused API functions from the demangler Context.

fixes rdar://problem/30503344
2017-03-09 13:42:43 -08:00
kitasuke
d433428402 Define BUILTIN_TYPE_NAME_PREFIX constant in Strings.h
Delete redundant comment

Use upper case for constant
2017-01-02 00:40:45 +09:00
kitasuke
52b4ae461b Define BUILTIN_TYPE_NAME constants in Strings.h 2018-03-18 17:37:21 +09:00