Commit Graph

71 Commits

Author SHA1 Message Date
Enrico Granata
6e666c7c22 <rdar://problem/15321132>
Demangle nominal type descriptor _TMn correctly



Swift SVN r9675
2013-10-25 18:02:46 +00:00
Enrico Granata
ef9a1b32d4 <rdar://problem/15213551>
This checkin extends the Demangler to allow printing sugar on demangled types
Namely, it introduces a DemanglerOptions class with just one field SynthesizeSugarOnTypes which has the same functionality as PrintOptions::SynthesizeSugarOnTypes
This changes outputs like _TtGSqC5sugar7MyClass_ ---> swift.Optional<sugar.MyClass> into _TtGSqC5sugar7MyClass_ ---> sugar.MyClass?

By default this flag is false, so that existing clients of the Demangler API do not break

OTOH, the command-line tool swift-demangle flags sets the flag to true, unless the -no-sugar option is passed on the command-line

Test cases included



Swift SVN r9502
2013-10-18 22:05:08 +00:00
Joe Groff
3d4c1251f1 Rename 'byref' attribute to 'inout'.
Swift SVN r8661
2013-09-25 20:56:52 +00:00
Argyrios Kyrtzidis
9e0cfb811d [AST] Allow the mangler to handle declarations with error types in them.
This is only useful for unique-identification uses of the mangler, like in SourceKit,
which has to deal with invalid code.
Since this is not related to ABI, we can change the encoding anytime we want.

Swift SVN r8557
2013-09-23 16:11:26 +00:00
Joe Groff
e109124186 Replace 'union' keyword with 'enum'.
This only touches the compiler and tests. Doc updates to follow.

Swift SVN r8478
2013-09-20 01:33:14 +00:00
Joe Groff
6dbc1a8835 Add manglings for associated types.
This should allow declarations inside protocols to mangle successfully, which is needed by SourceKit to be able to use mangled names as unique decl identifiers. I'm also planning to use mangled protocol decls to name generic curry thunk symbols.

This only introduces a mangling for independent associated types. I think we will eventually want to mangle dependent associated types (such as T.AssocType for an archetype T : SomeProtocol) with a non-indexed mangling too, but this doesn't do that yet.

Swift SVN r8148
2013-09-12 15:29:08 +00:00
Enrico Granata
b3576d8599 Replacing the GenericTypeApplication node with more specific BoundGeneric{Class|Structure|Union} nodes
Removing the TypeList node underneath a TypeList, a TypeList just needs to wrap a list of Type nodes



Swift SVN r7990
2013-09-06 17:47:06 +00:00
Enrico Granata
80278dfedc Simplifying the demangling for UncurriedFunctionType objects, from:
k = UncurriedFunctionType
  k = UncurriedFunctionMetaType
    k = Type
      k = MetaType

to:
k = UncurriedFunctionType
  k = MetaType

This should help Greg parse uncurried functions with greater ease



Swift SVN r7964
2013-09-05 23:09:10 +00:00
Enrico Granata
389c867551 Making the Demangler work properly with nested types, in the sense that Paths that represent nested types need to come out flat instead of hierarchical
Adding a couple test cases for this



Swift SVN r7724
2013-08-29 18:20:09 +00:00
Enrico Granata
72112bf575 More demangler changes - these introduce a new structure to the demangling that is better suited to Greg\'s need to produce types and decls out of demangled trees
Swift SVN r7714
2013-08-29 01:52:58 +00:00
Enrico Granata
a199242321 Sending 7641 again + a fix for the inf loop that Dmitri found
I also added that one as a test case



Swift SVN r7656
2013-08-28 01:02:01 +00:00
Dmitri Hrybenko
6eb5bc58d2 Revert r7641. It causes an infloop while demangling a name in test/SILGen/class_bound_protocols.swift
Swift SVN r7647
2013-08-27 23:36:35 +00:00
Enrico Granata
ff3ea6e3ce <rdar://problem/14830080> & <rdar://problem/14822344>
The previous implementation of the tree structure for the demangler had a bug in the low-level tree management code which caused the tree structure to diverge depending on whether
nodes were added as siblings or children. This checkin fixes the issue by making sure that the tree of nodes is kept coherent at all times.
Some adjustments are necessary to ensure the nodes were still generated properly and correctly turned into strings
Added a new test case



Swift SVN r7643
2013-08-27 22:56:48 +00:00
Enrico Granata
f2ba4c8c59 This commit changes the way the Demangler handles substitutions
Previously, substitutions were treated as unstructured text chunks, but this was causing problems when using the demangler as a source of structured type information
This patch ensures that substitutions are properly stored as the type they represent for later semantic reconstruction



Swift SVN r7494
2013-08-23 00:21:26 +00:00
Enrico Granata
687b142101 Undoing the damage of clang-format + first round of demangler cleanup
Swift SVN r7342
2013-08-19 23:15:51 +00:00
Chris Lattner
8d1f71deb1 demangle some of the demangler source code.
Swift SVN r7335
2013-08-19 22:37:53 +00:00
Enrico Granata
2d97d22d33 clang-formatted the Demangler
Swift SVN r7334
2013-08-19 22:34:30 +00:00
Enrico Granata
47d1a137b5 Major demangler changes.
This commit changes the Swift demangler to produce a tree-like list of tokens instead of a string.
This is mostly useful for LLDB since we can use the inherent structure in a Swift mangled name to make more informed decisions about matters such as type information extraction from modules
The ability to convert the tokenized output into a plain string for viewing purposes is of course preserved



Swift SVN r7297
2013-08-16 22:30:58 +00:00
Dmitri Hrybenko
de59d8dcd4 Remove unneeded llvm:: qualifier for llvm::StringRef and llvm::SmallVector
Swift SVN r7089
2013-08-09 18:41:46 +00:00
Enrico Granata
c3d42b5f86 Removing the demangleType() API and the --type flag to swift-demangle
Types now have proper mangled names of the form _Tt<...> so they don't need any special treatment



Swift SVN r6816
2013-08-01 21:00:05 +00:00
Enrico Granata
c75fe924a1 Moving the Swift demangler from libSIL to libBasic
Plus, a couple of minor cosmetic changes that I had held off for a couple days now



Swift SVN r6691
2013-07-29 17:42:57 +00:00