Commit Graph

9 Commits

Author SHA1 Message Date
Ben Barham
cb81c1a1aa [SourceKit] Add structure node for SubscriptExpr
Arguments in `SubscriptExpr` are visited since the recent `ArgumentList`
refactoring, but were being added to the containing `CallExpr`. Add a
node for the `SubscriptExpr` itself so that its argument is added there
instead of the `CallExpr`.

Also remove `key.nameoffset` and `key.namelength` from the response when
both are 0 to match the rest of the offsets and lengths.

Resolves rdar://85412164.
2021-11-30 19:56:48 +10:00
Nathan Hawes
2420b6d28b [SourceKit] Don't report the ObjC runtime name without @objc(Name)
We used to compute the mangled name in other cases, but document structure is
a syntactic request and can't guarantee that the class/protocol we're getting
the mangled name of is valid in any way so it often breaks assumptions in the
mangler and causes it to crash. It's not clear if the runtime_name is actually
being used anymore, so this change restricts reporting it to just the cases
where we don't need to mangle.

rdar://problem/40956377
2020-02-14 11:40:09 -08:00
Rintaro Ishizaki
2b0728bc95 [SourceKit] Use "-" as fallback complier argument
Since compiler arguments are processed by Driver, arbitrary filename
passed as 'request.name' (e.g. "", "-1", etc.) may cause problems.
Using '-' guarantees successful initialization of 'CompilerInvocation'.

rdar://problem/40646921
rdar://problem/40955808
2018-07-05 16:11:51 +09:00
Ben Langmuir
72bde687e4 [sourcekit] Use the driver to parse command line arguments
Stop parsing frontend arguments directly and use the driver instead. The
most intersting part of this change is that it forces us to consider
whether our compiler invocation will have inputs or not.  We have
several kinds of requests that need to create a compiler instance, but
not parse any inputs (interface-generation, doc-info, and indexing when
operating on a module instead of source files).

Incidentally, add an error when trying to do doc-info on multiple source
files. This was already very broken (assertion failures and bogus source
locations), so add an error for it.

rdar://problem/17897287
2018-02-05 15:49:17 -08:00
Ben Langmuir
9f3df20dbd [sourcekit] Change fallback module name to match driver
This will reduce test churn when we start using the driver to parse
arguments.  We don't really care what the module name is for these
fallback cases.
2018-02-02 10:26:58 -08:00
Marcelo Fabri
40b054b642 [SourceKit] Add local variables to structure (SR-5057) (#11431) 2017-08-11 13:43:05 -07:00
Jordan Rose
7bfdd4a20b Provide fix-its when overriding a bridged type with the old type.
This is support for SE-0069: Mutability and Foundation Value Types.
In cases where someone has overridden a method that takes, e.g.
'NSURL', the override will no longer be valid, because the system
class will now use the value type 'URL' instead. If an override's
full name matches exactly, the compiler will offer fix-its for any
uses of reference types where value types are now preferred.
(This must be a direct match; subclasses, including the mutable
variants of many Foundation types, will need to be updated by hand.)

One wrinkle here is the use of generics. In Swift 2, Objective-C
generics weren't imported at all, so it's unlikely that the overriding
method will have the correct generic arguments. Simple migration
might insert the "bound" type, but it can't know what specific type
might be more appropriate. Therefore, the logic to add the fix-it
ignores generic arguments, assuming the parent's type is correct.

rdar://problem/26183575
2016-05-27 10:58:14 -07:00
Argyrios Kyrtzidis
c78f1699cc [SourceKit] Ignore the '__raw_doc_comment' attribute, which is more of an implementation detail. 2016-05-05 16:44:34 -07:00
Argyrios Kyrtzidis
8ff6a98a99 [sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.

SourceKit is disabled on non-darwin platforms.
2015-11-05 01:09:08 -08:00