Commit Graph

779 Commits

Author SHA1 Message Date
Erik Eckstein
a56a97c89f Mangling: prepare for using new mangling for USR and debug-info type generation.
Select between old and new mangling as we already do in other places in the compiler.
NFC as long as the new mangling is not enabled yet.
2017-01-23 17:49:00 -08:00
Erik Eckstein
cdf2c1e43a New mangling: fix a bug in debug-info type mangling and enable testing it (by comparing with the old mangling) 2017-01-20 17:14:18 -08:00
Slava Pestov
ee295ddbb8 AST: Nuke the unqualified archetype mangling 2017-01-12 23:20:35 -08:00
Roman Levenstein
8b6a0315a4 (De)Mangling of layout constraints and requirements. 2017-01-12 00:57:06 -08:00
Michael Gottesman
d944930591 Remove the deallocating convention.
This is dead code and can be re-added if it is needed. Right now though there
really isnt a ValueOwnershipKind that corresponds to deallocating and I do not
want to add a new ValueOwnershipKind for dead code.
2017-01-10 17:32:17 -08:00
Hugh Bellamy
7a5ef4bdd1 Support building swift/AST with MSVC on Windows 2017-01-09 09:05:06 +00:00
Brian Gesiak
663b92ece9 [AST] Completely replace Module with ModuleDecl
The typedef `swift::Module` was a temporary solution that allowed
`swift::Module` to be renamed to `swift::ModuleDecl` without requiring
every single callsite to be modified.

Modify all the callsites, and get rid of the typedef.
2017-01-08 00:36:08 -05:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Erik Eckstein
3014fd5bf6 Mangling: migrate a change from the old AST mangler to the new one 2016-12-20 13:47:48 -08:00
practicalswift
8cb414811f Merge pull request #6369 from practicalswift/initialize-initialParamDepth
[gardening] Initialize initialParamDepth to zero to avoid calling getDeclTypeForMangling(…) and appendGenericSignatureParts(…) with uninitialized arguments.
2016-12-19 17:42:44 +01:00
Slava Pestov
fb0f372e94 AST: Move mapType{In,OutOf}Context() out of ArchetypeBuilder and clean up headers
- The DeclContext versions of these methods have equivalents
  on the DeclContext class; use them instead.

- The GenericEnvironment versions of these methods are now
  static methods on the GenericEnvironment class. Note that
  these are not made redundant by the instance methods on
  GenericEnvironment, since the static methods can also be
  called with a null GenericEnvironment, in which case they
  just assert that the type is fully concrete.

- Remove some unnecessary #includes of ArchetypeBuilder.h
  and GenericEnvironment.h. Now changes to these files
  result in a lot less recompilation.
2016-12-18 19:55:41 -08:00
practicalswift
81e434af1b [gardening] Initialize initialParamDepth to zero to avoid calling getDeclTypeForMangling(…) and appendGenericSignatureParts(…) with uninitialized arguments. 2016-12-18 19:11:46 +01:00
practicalswift
16d6dce62e [gardening] Fix recently introduced typos. 2016-12-16 21:42:09 +01:00
Slava Pestov
2c6b9f71b6 AST: Change TypeAliasDecls to store an interface type as their underlying type
- TypeAliasDecl::getAliasType() is gone. Now, getDeclaredInterfaceType()
  always returns the NameAliasType.

- NameAliasTypes now always desugar to the underlying type as an
  interface type.

- The NameAliasType of a generic type alias no longer desugars to an
  UnboundGenericType; call TypeAliasDecl::getUnboundGenericType() if you
  want that.

- The "lazy mapTypeOutOfContext()" hack for deserialized TypeAliasDecls
  is gone.

- The process of constructing a synthesized TypeAliasDecl is much simpler
  now; instead of calling computeType(), setInterfaceType() and then
  setting the recursive properties in the right order, just call
  setUnderlyingType(), passing it either an interface type or a
  contextual type.

  In particular, many places weren't setting the recursive properties,
  such as the ClangImporter and deserialization. This meant that queries
  such as hasArchetype() or hasTypeParameter() would return incorrect
  results on NameAliasTypes, which caused various subtle problems.

- Finally, add some more tests for generic typealiases, most of which
  fail because they're still pretty broken.
2016-12-15 22:46:15 -08:00
Erik Eckstein
eb9cadb501 Mangling: add a substitution for optional types (bound generic enum Swift.Optional) 2016-12-14 16:40:13 -08:00
Erik Eckstein
4a492fc5a7 Mangling: Change new mangling for bound generic types.
Putting the nominal type in the first place increases the changes for common prefixes (for the trie).
2016-12-14 16:39:00 -08:00
swift-ci
d694e1e6b3 Merge pull request #6164 from eeckstein/mangling-changes 2016-12-09 11:31:25 -08:00
Xi Ge
6bbdf4a837 [Mangler] Check the order of generic type parameters before mangling them to avoid assertion hit. 2016-12-09 09:51:40 -08:00
Erik Eckstein
7cadbb29c1 Mangling: correct mangling/demangling/remangling of the error and unknown type 2016-12-09 09:05:18 -08:00
Erik Eckstein
b0c95278e1 Mangling: introduce ‘D’ for mangled types for the debugger.
This is what ‘_Tt’ was in the old mangling.
Maybe we don’t need this eventually. But currently at least swift-ide-test relies on having a special mangling for such symbols
2016-12-09 09:05:16 -08:00
Joe Groff
15a2432efb Merge pull request #6135 from jckarter/use-sil-box-field-accessors-4
Mangle SILBoxTypes with their layout.
2016-12-08 21:09:31 -08:00
Joe Groff
7429ffb228 Mangle SILBoxTypes with their layout.
Use a new mangling scheme that describes the layout of compound boxes. For compatibility with reflection-based clients, continue to use the legacy mangling for single-field boxes when emitting reflection TypeRefs until we fully support reflection for the new box implementation.
2016-12-08 20:02:44 -08:00
Slava Pestov
f3c72d8941 AST: Remove SubstitutedType 2016-12-07 17:03:07 -08:00
Michael Gottesman
1af1cbfb76 [gardening] Add a bunch of end namespace comments found by clang-tidy. 2016-12-06 19:22:52 -08:00
practicalswift
cfdaf9f14a [gardening] Fix invalid Swift URLs. 2016-12-06 20:12:20 +01:00
Erik Eckstein
0db5a17925 Mangling: merge a fix for an IDE crasher to the new ASTMangler 2016-12-05 13:57:18 -08:00
Erik Eckstein
786bd67bd0 Mangling: fix new mangling and de-mangling of private operators 2016-12-05 12:34:25 -08:00
Slava Pestov
1a991da16d AST: Assign interface types to ParamDecls
First, ensure all ParamDecls that are synthesized from scratch are given
both a contextual type and an interface type.

For ParamDecls written in source, add a new recordParamType() method to
GenericTypeResolver. This calls setType() or setInterfaceType() as
appropriate.

Interestingly enough a handful of diagnostics in the test suite have
improved. I'm not sure why, but I'll take it.

The ParamDecl::createUnboundSelf() method is now only used in the parser,
and no longer sets the type of the self parameter to the unbound generic
type. This was wrong anyway, since the type was always being overwritten.
This allows us to remove DeclContext::getSelfTypeOfContext().

Also, ensure that FuncDecl::getBodyResultTypeLoc() always has an interface
type for synthesized declarations, eliminating a mapTypeOutOfContext()
call when computing the function interface type in configureInterfaceType().

Finally, clean up the logic for resolving the DynamicSelfType. We now
get the interface or contextual type of 'Self' via the resolver, instead
of always getting the contextual type and patching it up inside
configureInterfaceType().
2016-12-04 00:02:21 -08:00
Erik Eckstein
684092d7d1 Mangling: mangler, demangler and remangler classes for the new mangling scheme.
Following classes provide symbol mangling for specific purposes:
*) Mangler: the base mangler class, just providing some basic utilities
*) ASTMangler: for mangling AST declarations
*) SpecializationMangler: to be used in the optimizer for mangling specialized function names
*) IRGenMangler: mangling all kind of symbols in IRGen

All those classes are not used yet, so it’s basically a NFC.

Another change is that some demangler node types are added (either because they were missing or the new demangler needs them).
Those new nodes also need to be handled in the old demangler, but this should also be a NFC as those nodes are not created by the old demangler.

My plan is to keep the old and new mangling implementation in parallel for some time. After that we can remove the old mangler.
Currently the new implementation is scoped in the NewMangling namespace. This namespace should be renamed after the old mangler is removed.
2016-12-02 15:55:30 -08:00