Commit Graph

153 Commits

Author SHA1 Message Date
Xi Ge
ed56e493f1 RangeInfo: disallow expressions with non-void type at the start or the end of multi-statement selections. (#8092) 2017-03-14 16:59:28 -07:00
practicalswift
98d2254073 [gardening] Fix a-vs-an typos 2017-02-24 09:38:00 +01:00
practicalswift
33a5601ad1 [gardening] Fix typos 2017-02-23 22:46:40 +01:00
Xi Ge
c62ec0c116 SourceKit: Introduce a new enum class to describe the kind of resolved sema token kind. NFC (#7657) 2017-02-20 23:18:54 -08:00
Xi Ge
3afb5572c0 [RangeInfo] Add a field in ResolvedRangeInfo to indicate whether the range throws uncatched errors. rdar://30586209 (#7574) 2017-02-17 17:49:00 -08:00
Xi Ge
2bfe5418a0 [IDE] Utils: Allow indexed access to DelayedStringRetriever. (#7567) 2017-02-17 11:34:29 -08:00
Xi Ge
b1c5c995a1 [IDE][Utils] Add an IDE stream utility. (#7546)
This provides a stream utility for writing to a underlying string buffer multiple string pieces and retrieve them later as StringRef when the underlying buffer is stable.
2017-02-16 17:29:42 -08:00
Xi Ge
6b699d8855 SourceEntityWalker: keep track of type reference in extension declarations' openings. (#7192)
This is necessary when we want to differentiate between type reference
on extension declaration's start, e.g "extension A {}", and other
references of "A". NFC on existing functionality.
2017-02-01 17:09:01 -08:00
Xi Ge
602235ed52 [RangeInfo] Report the case when a continue/break statement is in the given range however the containing target is not. (#7157) 2017-01-31 11:37:24 -08:00
Xi Ge
e7a16bf246 [RangeInfo] Include a boolean value in the resolved range info to indicate whether the given range has more than one entry point. (#7150)
A classic multi-entry range is several case statements.
2017-01-30 13:42:34 -08:00
practicalswift
30a88d38e6 [gardening] Fix recently introduced typos 2017-01-06 21:16:02 +01:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Xi Ge
46eb3971f5 [RangeInfo] Some enrichment on reported range info. (#6475)
* [RangeInfo] Perform complete walk on the last node in a given range to avoid missing information due to early abort.

* [RangeInfo] For declared decls in a given range, report whether they are referenced outside of the range.

* [RangeInfo] Report the contained (topmost) ASTNodes inside a selected range.
2017-01-03 16:33:39 -08:00
Xi Ge
94851e25d7 [RangeInfo] Report the innermost decl context for the range under selection. (#6448) 2016-12-21 16:50:39 -08:00
Xi Ge
14f968a5ed SourceEntityWalker: Add a parameter to visitDeclReference() describing the kind of the reference under visit. NFC 2016-12-20 14:30:02 -08:00
Xi Ge
ba930deff2 [RangeInfo] When reporting referenced decls, also report the types of these references. 2016-12-19 17:16:17 -08:00
Xi Ge
eb80cdd8ce [RangeInfo] Report declared and referenced decls in a given range. 2016-12-19 13:27:20 -08:00
Xi Ge
3b68ca2936 [IDE][Utils] Elevate a decl name viewer utility from swift-api-digester.
This utility parses a given StringRef to a base name and several argument
names and provides a convenient view on them.
2016-12-01 16:29:08 -08: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
5e8d8da380 [Test] Add range-info test driver to swift-ide-test. NFC 2016-11-15 13:48:15 -08:00
Xi Ge
d6f8f142a7 [SourceKit] Teach range-info request to recognize single declaration and multi-statements. (#5672) 2016-11-07 16:54:48 -08:00
Xi Ge
ac3411234d [SourceKit] The initial implementation of range-info request.
Like cursor-info, range info (""source.request.cursorinfo"") answers some
questions clients have for a code snippet under selection, for instance, the type of a selected
expression. This commit implements this new quest kind and provides two
simple information about the selected code: (1) the kind of the
snippet, currently limited to single-statement and expression; and (2)
the type of the selected expression. Gradually, we will enrich the
response to provide more insight into the selected code snippet.
2016-11-03 16:07:04 -07:00
Slava Pestov
cfe9e6a3de IDE: Use GenericSignatures and interface types (mostly)
There was a ton of complicated logic here to work around
two problems:

- Same-type constraints were not represented properly in
  RequirementReprs, requiring us to store them in strong form
  and parse them out when printing type interfaces.

- The TypeBase::getAllGenericArgs() method did not do the
  right thing for members of protocols and protocol extensions,
  and so instead of simple calls to Type::subst(), we had
  an elaborate 'ArchetypeTransformer' abstraction repeated
  in two places.

Rewrite this code to use GenericSignatures and
GenericFunctionType instead of old-school GenericParamLists
and PolymorphicFunctionType.

This changes the code completion and AST printer output
slightly. A few of the changes are actually fixes for cases
where the old code didn't handle substitutions properly.
A few others are subjective, for example a generic parameter
list of the form <T : Proto> now prints as <T where T : Proto>.

We can add heuristics to make the output whatever we want
here; the important thing is that now we're using modern
abstractions.
2016-10-02 23:49:15 -04:00
Xi Ge
2ae236808c [CodeCompletion] Refactor archetype transform to avoid using recursion. rdar://27615558
We have a radar (rdar://27615558) complaining the exiting recursive calls in type transform
of code completion hangs. This patch refactor the existing code to avoid using
recursion. From existing tests' perspective, this is NFC. I am not able to contrive the
test case that leads to the hang, neither is given by the radar.
2016-08-09 16:33:17 -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
Ben Langmuir
4d9c9f6098 Move SourceEntityWalker into libAST NFC
It fits right in among our other AST walkers and lets us use it lower in
the stack than libIDE.
2016-04-01 14:14:06 -07:00
Ben Langmuir
47d2c24078 [IDE] Factor code that looks up USRs into getDeclFromUSR 2016-03-16 15:43:02 -07:00
Ben Langmuir
d51c0f1aa7 [IDE] StringRefize the ReconstructType APIs NFC
Luckily const char* clients can work unmodified.
2016-03-11 14:24:32 -08:00
Ben Langmuir
5725d22c89 [IDE] Add an entry point to get decls out of 'ReconstructType'
For now, just tack the testing onto the existing walker that checks the
types.  It doesn't seem to work at all for local declarations yet, but
at least we get some top-level stuff.
2016-03-09 21:14:29 -08:00
Ben Langmuir
3866e74604 [IDE] Fix some 80-column violations in Utils.h NFC 2016-03-07 18:56:25 -08:00
Enrico Granata
66cf479f31 Add an API that exactly mimics LLDB's GetTypeFromMangledTypename but uses ReconstructType.cpp as a node visitor 2016-01-25 15:39:07 -08:00
practicalswift
a3f857ca7b [gardening] Add "-*- C++ -*-" to header files currently missing it 2016-01-23 11:53:05 +01:00
Xi Ge
5a7a4f461d Port a util "getTypeFromMangledTypename" from lldb (lldb/source/Symbol/SwiftASTContext.cpp) to IDE and add some tests against it.
This utility helps us reconstruct type from a mangled name. SourceKit needs this functionality to deliver
richer doc-info/cursor-info.

Thanks for Sean's help!
2016-01-13 13:43:15 -08:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
26b5234a80 Fix typo: currect → correct 2015-12-14 00:11:32 +01:00
Xi Ge
9beeb56a90 [TypeInterface] When printing type-specific interfaces, replace parameter and return types with instantiated types. 2015-11-17 19:12:30 -08:00
Xi Ge
a1493133a0 Refactor ArchetypeTransformer into a reusable IDE utility. NFC 2015-11-17 19:12:30 -08:00
Xi Ge
5ca83d97a5 [InterfacePrint] Enhance ASTPrinter to support type-specific interface printing.
When users try to print the interface of a specific type (most often through cursor
infor query of SourceKit), we should simplify the original decls by replacing
archetypes with instantiated types, hiding extension details, and omitting
unfulfilled extension requirements. So the users can get the straight-to-the-point
"type interface". This commit builds the testing infrastructure for this feature,
and implements the first trick that wraps extension contents into the interface body.

This commit also moves some generic testing support from SourceKit to Swift.

Swift SVN r32630
2015-10-12 19:14:58 +00:00
Doug Gregor
b8995b0aa3 Transform the Module class into ModuleDecl.
Modules occupy a weird space in the AST now: they can be treated like
types (Swift.Int), which is captured by ModuleType. They can be
treated like values for disambiguation (Swift.print), which is
captured by ModuleExpr. And we jump through hoops in various places to
store "either a module or a decl".

Start cleaning this up by transforming Module into ModuleDecl, a
TypeDecl that's implicitly created to describe a module. Subsequent
changes will start folding away the special cases (ModuleExpr ->
DeclRefExpr, name lookup results stop having a separate Module case,
etc.).

Note that the Module -> ModuleDecl typedef is there to limit the
changes needed. Much of this patch is actually dealing with the fact
that Module used to have Ctx and Name public members that now need to
be accessed via getASTContext() and getName(), respectively.

Swift SVN r28284
2015-05-07 21:10:50 +00:00
Argyrios Kyrtzidis
a586753f0f [IDE] Implement generating the Swift interface for an C/ObjC header
This translates clang arguments to swift ones, uses the bridging header
functionality to parse the provided file, and re-uses part of the module interface
printing implementation to print an interface for the header.

Part of rdar://19939192

Swift SVN r28062
2015-05-02 01:17:45 +00:00
Xi Ge
fb2c8aa103 [SDKAnalyzer] The initial commit of swift sdk digester.
This tool takes the input of two versions of the same sdk and outputs
their diff to facilicate the auto-migration of sdk clients.
In this initial commit, we take the path of one sdk and generate
a tree describing its API content. Next, we will diff trees generated
from different versions of the sdk.

In addition, this commit also refactored out part of swift-sdk-analyzer
to the common utils shared with swift-sdk-digester.

Swift SVN r26656
2015-03-28 00:05:28 +00:00
Argyrios Kyrtzidis
0c54a120a0 [IDE] Introduce ide::replacePlaceholders() which replaces Xcode editor placeholders with dollar identifiers
and returns a new memory buffer.

Swift SVN r25897
2015-03-09 23:02:56 +00:00
Argyrios Kyrtzidis
d039fb6369 [AST] Move ide::findUnderlyingClangModule() to Module::findUnderlyingClangModule() so that the ASTPrinter can use it.
Swift SVN r23691
2014-12-04 20:17:03 +00:00
Sonny Falk
8094d8d633 [IDE] Add utility function for walking overridden declarations, including
protocol conformances and clang declarations.

Swift SVN r20909
2014-08-01 19:07:15 +00:00
Argyrios Kyrtzidis
3175251bb1 [IDE] Handle annotation of clang submodule imports properly.
rdar://17780613

Swift SVN r20595
2014-07-26 20:58:19 +00:00
Argyrios Kyrtzidis
2380966931 [IDE] Enhance ide::isSourceInputComplete() function to also return indentation information.
Patch provided by GregC.

Swift SVN r16552
2014-04-18 22:12:40 +00:00
Dmitri Hrybenko
68e8fee5fc Comment parsing: put more information into the generated XML documents
This commit adds infrastructure for conversion and testing it.

The conversion is still incomplete, pending discussion about which tags should
we use in the XML documents.  I copied the RelaxNG schema from Clang, and will
edit it accordingly.


Swift SVN r16451
2014-04-17 15:42:51 +00:00
Dmitri Hrybenko
f7699f59b5 Comment parsing: generate a basic XML document from the brief comment
Swift SVN r15186
2014-03-18 11:09:53 +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