Commit Graph

95 Commits

Author SHA1 Message Date
Slava Pestov
4f3c56e81b IDE: Catch more invalid USR cases 2017-03-24 22:44:39 -07:00
Erik Eckstein
d70bfc5de2 rename namespace NewMangling -> Mangle 2017-03-20 10:09:30 -07:00
Erik Eckstein
1625345b90 Remove the old mangler.
NFC
2017-03-17 16:10:36 -07:00
Erik Eckstein
761d6512fe SourceKit: switch to new mangling in ide::printDeclTypeUSR
This was still missing.
2017-03-16 19:57:16 -07:00
Nathan Hawes
7b75cf792c [indexer] Index parameter definitions with a distinct external argument label too (but not their refs)
Parameter defs with a separate external argument label are marked with the 'Local' symbol property.
This ensures the indexer has enough information for clients to match up a function's argument labels with its child parameter definitions.
Resolves rdar://problem/31039915.
2017-03-14 16:12:48 -07:00
practicalswift
a7c096f386 [gardening] Make sure parameter comment match actual parameter name 2017-03-07 16:26:08 +01:00
Ben Langmuir
a35eb6da1d [USR] Fix USRs for @objc initializers
In Swift, init() is represented as a class method, but in ObjC it is an
instance method.  This fixes the USRs we generate for @objc inits so they
match the ObjC USRs.

rdar://problem/30707115
2017-02-27 14:21:46 -08:00
Erik Eckstein
7995d3d35a SourceKit: Use new mangling for USR generation. 2017-02-23 12:47:10 -08:00
Nathan Hawes
0dc0985f45 Move SwiftNameTranslation implementation out of Decl.cpp and into its own file.
Also fix code formatting issues and simplify the code in USRGeneration.cpp based on review comments in PR #7670.
2017-02-21 14:54:31 -08:00
Nathan Hawes
c9758c2c0f Use clang-style USRs for swift decls that are exposed to Objective C 2017-02-21 09:42:33 -08:00
Argyrios Kyrtzidis
bf80cff4d0 [index] Fix assertion hit during USR generation, when encountering an erroneous computed var. 2017-02-14 10:19:04 -08:00
Argyrios Kyrtzidis
b62bd0c086 [USRGeneration] For clang macro USRs, use the more general API that doesn't require a PreprocessingRecord. 2017-02-02 10:24:57 -08:00
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
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Erik Eckstein
5ac0c5b9b7 Mangling: wire up the new mangling in various places in the compiler, but still use the old mangling.
The purpose of this change is to test if the new mangling is equivalent to the old mangling.
Both mangling strings are created, de-mangled and checked if the de-mangle trees are equivalent.
2016-12-05 14:07:05 -08:00
Slava Pestov
1657060d1e AST: hasType() => hasInterfaceType() 2016-11-29 03:05:30 -07:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Xi Ge
7bd01b5ad1 [SourceKit] Never try to report mangled names for archetypes without contexts. rdar://28094209 2016-10-24 16:56:32 -07:00
Argyrios Kyrtzidis
62f30d50d2 [SourceKit] For clang enums imported as error domains, make sure to use unique USRs.
Error domain enums are imported with synthesizing something like this:

 struct MyError {
     enum Code : Int32 {
         case errFirst
         case errSecond
     }
     static var errFirst: MyError.Code { get }
     static var errSecond: MyError.Code { get }
 }

The clang enum and enum constants are associated with both the
struct/nested enum, and the static vars/enum cases.
But we want unique USRs for the above symbols, so use the clang USR
for the enum and enum cases, and the Swift USR for the struct and vars.

rdar://27550967
2016-07-27 21:42:36 -07:00
Xi Ge
8cfefd35ce [libide] Finish related lib-ide work on generating type-interface, rdar://27306890. (#3501) 2016-07-14 08:48:28 -07:00
Xi Ge
a7e4cfd042 [SourceKit] Report container type USRs in the response to cursor-info request.
Typically, users jump to type-specific interface from a member of that type, for
instance, a.getSomething(). To generate the interface, we need to report the USR
of the container type of "getSomething()", which is the USR for the type of a,
 when cursor info is requested for this function call.
2016-07-12 15:50:18 -07:00
Xi Ge
a5e51a3494 [SourceKit] In CursorInfo response, include the mangle name of the type of the underlying decl.
The mangled name of the type is identical to those for debugger. These
mangled names allow us to reconstruct the type from AST and generate interface
specifically for that type.

Related rdar://27306890
2016-07-12 13:10:58 -07:00
Slava Pestov
2c21b81910 AST: Clean up archetype mangling
Now that we have ArchetypeBuilder::mapTypeOutOfContext(), we can
delete some tricky hand-crafted logic for getting the depth and
index of archetypes.

Notice that the depth of an archetype is now the same as generic
parameters, where depth 0 is the outermost generic context.
Previously it was backwards.

Mostly NFC, except that a few IDE crashers are now fixed because
of asserts firing in removed code, and also the change to depth
mangling (which I think makes sense, and it matches what's written
in docs/ABI.rst).
2016-06-01 12:54:43 -07:00
Xi Ge
8cce226621 USR: Also add nominal check for the inheritance. 2016-03-16 19:27:34 -07:00
Xi Ge
e9e2a264c3 USR: Not crashing when extended type are not nominal, say, a type alias. 2016-03-16 19:20:50 -07:00
Xi Ge
aa44cfcbf0 [Serialization] Mock USRs for inheritance-only extensions so that their comments can be serialized as well.
Suggested by @jrose-apple
2016-03-16 17:29:37 -07:00
Xi Ge
f81d82efd5 [Serialization] Change the prefix to make extension USR be consistent with other Swift USRs.
Suggested by @@benlangmuir
2016-03-16 17:29:37 -07:00
Xi Ge
2751bb96b6 [Serialization] Shorten extension USRs.
We actually do not need to pre-append the USR of the extended nominal;
a short mangling-incompatible prefix will sufficiently do the trick.

Suggested by @jrose-apple.
2016-03-15 18:10:58 -07:00
Xi Ge
d0e176810f [Serialization] Serialize doc comments for extensions. Need this for rdar://25157796
We did not serialize them because getting USR for extensions is tricky (USRs are
usually for value decls). This commit starts to make up an USR for an extension by combining
the extended nominal's USR with the USR of the first value member of the extension. We use
this made-up USR to associate doc comments when (de)serializing them.
2016-03-15 13:35:07 -07:00
Chris Lattner
ae919bd447 implement mangling support for typealias archetypes, allowing them to get basic USRs. 2016-03-08 21:18:39 -08:00
Ben Langmuir
bac7521af7 [SourceKit] Fix crash with cursor info on generic typealias
For now, just skip mangling the name since we know the decl context will
crash the mangler.
2016-03-08 18:03:42 -08:00
Slava Pestov
6af7f95a5a We don't need to plumb a resilience expansion through mangling, NFC
I'm going to be adding deployment target info ResilienceExpansion
soon so removing unnecessary usages helps reduce the amount of
work there.
2016-01-07 08:15:26 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Nadav Rotem
07d4558c1c [Mangler] Change the Swift mangler into a symbol builder.
This commit changes the Swift mangler from a utility that writes tokens into a
stream into a name-builder that has two phases: "building a name", and "ready".
This clear separation is needed for the implementation of the compression layer.

Users of the mangler can continue to build the name using the mangleXXX methods,
but to access the results the users of the mangler need to call the finalize()
method. This method can write the result into a stream, like before, or return
an std::string.
2015-12-25 21:40:25 -08:00
practicalswift
cd7d8dfaff Fix alignment as requested by @gribozavr in #692 2015-12-21 08:54:24 +01:00
practicalswift
176f487d76 Fix incorrect filenames in headers. 2015-12-20 23:59:05 +01:00
John McCall
dc4431ebff Split addressors into unsafe, owning, and pinning variants.
Change all the existing addressors to the unsafe variant.

Update the addressor mangling to include the variant.

The addressor and mutable-addressor may be any of the
variants, independent of the choice for the other.

SILGen and code synthesis for the new variants is still
untested.

Swift SVN r24387
2015-01-13 03:09:16 +00:00
Argyrios Kyrtzidis
2e99e4da12 [IDE] Fix crash when trying to get the USR of an invalid enum element.
rdar://18314290

Swift SVN r21937
2014-09-13 03:54:11 +00:00
Argyrios Kyrtzidis
918f373d97 [AST] For USR generation, ignore symbols coming from the builtin module.
Swift SVN r17858
2014-05-11 00:00:57 +00:00
Argyrios Kyrtzidis
cc0fa4e1f7 [AST] Ignore unnamed vars for USR generation.
Swift SVN r17831
2014-05-10 19:15:09 +00:00
Argyrios Kyrtzidis
489d1d62cb [IDE] ide::printDeclUSR() should not try to get the USR for ValueDecls without types, due to invalid code.
Test case on SourceKit side.
Fixes crash of rdar://16746734.

Swift SVN r17023
2014-04-29 06:46:04 +00:00
Dmitri Hrybenko
28b05c99b4 Rework r16878. Now we refuse to generate a USR for 'self' in destructors
Filed rdar://16734962 to investigate the real bug.


Swift SVN r16881
2014-04-26 14:12:31 +00:00
Dmitri Hrybenko
c2354eb365 USR generation: generate USRs for imported macros
I do feel bad about introducing ClangModuleLoader, but it is better than a
layering violation (using libClangImporter from libAST).


Swift SVN r15679
2014-03-31 15:13:00 +00:00
Dmitri Hrybenko
866511e27d Add mangling for SubscriptDecls to allow us to produce USRs for them
<rdar://problem/16237251> USR generator skips SubscriptDecls


Swift SVN r14923
2014-03-11 18:03:04 +00:00
Dmitri Hrybenko
49754619ee Move USR generation to AST library, so that Serialization library can use it
Swift SVN r14681
2014-03-05 11:31:31 +00:00