Commit Graph

1419 Commits

Author SHA1 Message Date
Nathan Hawes
7680cc6b16 [sourcekitd] Report entities that are implicitly objc as objc in the index request responses for compatibility
Members of an @objcMembers context previous had implicit @objc attributes, but
now don't (possibly because of the request evaluator changes?). This updates the
output of sourcekitd's 'index' request to act as if they still had implicit
@objc attributes on them for compatibility.

Resolves rdar://problem/48140265
2019-02-22 16:35:30 -08:00
Slava Pestov
3dc5ae36a6 SourceKit: Use Demangle::getTypeDeclForUSR() to implement 'CursorInfo for USR' request
Fixes <rdar://problem/47819208>.
2019-02-22 16:13:03 -05:00
Nathan Hawes
4ced0afd9e Merge pull request #22764 from nathawes/add-implicit-to-index-request-output
[sourcekitd] Expose the 'implicit' symbol role in the 'index' request response
2019-02-21 15:17:43 -08:00
Nathan Hawes
e5e9dc6c05 [sourcekitd] Expose the 'implicit' symbol role in the 'index' request response
Resolves rdar://problem/48148270.
2019-02-20 17:12:23 -08:00
Xi Ge
5601a9826e Merge pull request #22753 from nkcsgexi/request-type
SourceKit: Add a new request to collect expression types in a source file.
2019-02-20 14:44:27 -08:00
Xi Ge
934104a5a7 Docs/SourceKit: add some documentation for expression type request. 2019-02-20 10:52:50 -08:00
Xi Ge
74e86a8f35 SourceKit: Add a new request to collect expression types in a source file.
This request collects the types of all expressions in a source file after type checking.
To fulfill this task, the client must provide the path to the Swift source file under
type checking and the necessary compiler arguments to help resolve all dependencies.

Request:

{
    <key.request>:            (UID)     <source.request.expression.type>,
    <key.sourcefile>:         (string)  // Absolute path to the file.
    <key.compilerargs>:       [string*] // Array of zero or more strings for the compiler arguments,
                                        // e.g ["-sdk", "/path/to/sdk"]. If key.sourcefile is provided,
                                        // these must include the path to that file.
}

Response:

{
    <key.printedtypebuffer>:          (string)                    // A text buffer where all expression types are printed to.
    <key.expression_type_list>:       (array) [expr-type-info*]   // A list of expression and type
}

expr-type-info ::=
{
  <key.expression_offset>:    (int64)    // Offset of an expression in the source file
  <key.expression_length>:    (int64)    // Length of an expression in the source file
  <key.type_offset>:          (int64)    // Offset of the printed type of the expression in the printed type buffer
  <key.type_length>:          (int64)    // Length of the printed type of the expression in the printed type buffer
}

rdar:://35199889
2019-02-20 10:49:39 -08:00
Bob Wilson
213efe089c Merge commit '06120c9d9d1a28275a0ecd7466775b1d71716be7' into stable-update-5.1 2019-02-17 10:20:59 -08:00
Xi Ge
c93700aa8b Address several post-commit comments. NFC 2019-02-14 22:09:32 -08:00
Nathan Hawes
2ebd983cbd Merge pull request #22514 from nathawes/sourcekit-support-for-parseable-interfaces-pt-2
Fix sourcekitd interface generation crashing for modules that only have a .swiftinterface file
2019-02-14 09:57:21 -08:00
Xi Ge
bbdcb14c9c swiftlang: build type of swiftlang should agree with the standard library 2019-02-13 17:58:06 -08:00
Nathan Hawes
d164c616b4 [ParseableInterface][sourcekitd] Set the DetailedPreprocessorRecord ClangImporter option on the sub invocation if it's set on the parent
In addition to capturing more detailed preprocessor info, the
DetailedPreprocessorRecord option sets the clang module format to 'raw'
rather than the default 'object'. Sourcekitd doesn't link the code
generation libs, which it looks like the default 'object' format requires,
so it sets this option to true. The subinvocation generated when loading a
module from a .swiftinterface file still used the default prior to this
change though, so it would end up crashing sourcekitd.

This change sets the DetailedProccessorRecord option if the DetailedRecord
option is set on the preprocessor options of parent context's clang module
loader. This fixes interface generation crashing for modules that only have
a .swiftinterface file.

rdar://problem/43906499
2019-02-13 14:13:25 -08:00
Rintaro Ishizaki
cf97dae9f1 [SourceKit] Fix memory issue in response construction for typecontextinfo
Buffer may be reallocated during the construction. We can't modify
buffer `SmallString` after getting 'StringRef' out of it.
2019-02-12 16:36:13 -08:00
Rintaro Ishizaki
552dcd81aa Merge pull request #22429 from rintaro/sourcekit-conformingmethods
[IDE/SourceKit] New SourceKit request for filtered method list
2019-02-11 18:13:15 -08:00
Xi Ge
4686cc87bd Merge pull request #22010 from marcelofabri/swift-version-request
[SR-9630][SourceKit] Add request to get compiler version
2019-02-09 21:55:44 -08:00
Rintaro Ishizaki
1d845d6e3f [IDE/SourceKit] New SourceKit request for filtered method list
`source.request.conformingmethods` is a new SourceKit request which
receives a source position and a list of protocol namses, returns a list
of methods whose return type conforms to the requested protocols.

rdar://problem/44699573
2019-02-08 12:56:58 -08:00
Bob Wilson
d023e563fc [master-next] Adjust sourcekitd-test PrintHelp call for LLVM r344097
The default "[options] <inputs>" text is now up to the caller to provide.
2019-02-07 17:54:10 -08:00
Ben Langmuir
1efade0b47 [cmake] Move install() after set_target_properties() to workaround crash
Calling install() on a framework target before setting the FRAMEWORK
property triggers a [crash](https://gitlab.kitware.com/cmake/cmake/issues/18848). Workaround by changing the call order.
2019-01-28 16:24:09 -08:00
Rintaro Ishizaki
606b551f87 [SourceKit] Fix a crash in SwiftDocumentStructureWalker::getObjCSelectorName()
SourceKit document structure request used to crash if if there's inititalizer
with single named parameter with `@IBAction` attribute.

This used to happen because
ConstructorDecl::isObjCZeroParameterWithLongSelector() requires
interface type of the parameter but the constructor doesn't have it at
this stage.

This change fixes that by not vending ObjC name for
constructor or destructors.

rdar://problem/47426948
2019-01-25 17:10:52 -08:00
Rintaro Ishizaki
37bb0492ff [SourceKit] Add trace logging for typecontextinfo request. 2019-01-23 12:10:14 -08:00
Marcelo Fabri
f61751bdcf [SR-9630][SourceKit] Add request to get compiler version 2019-01-20 10:39:25 -08:00
Robert Widmann
d7a406dbc2 Merge pull request #20950 from CodaFi/christmas-declarations
[NFC] Upgrade EnumElementDecl to a DeclContext
2019-01-18 17:25:22 -05:00
Argyrios Kyrtzidis
c7ac859310 [Parse] Optimize syntax parsing: Speed-up Lexer::lexTrivia()
Introduce ParsedTrivia which is a more efficient structure to use during lexing than syntax::Trivia.
2019-01-17 12:10:27 -08:00
Robert Widmann
c5b7230d22 [NFC] Upgrade EnumElementDecl to a DeclContext
Pure plumbing for the sake of default arguments.
2019-01-16 18:39:30 -05:00
Xi Ge
74dd07fa8d Merge pull request #21821 from iKichiemon/enum-case-to-lowercamelcase
enum SourceKitdError case to lower camel case
2019-01-14 16:46:41 -08:00
Rintaro Ishizaki
b446d6b051 Merge pull request #21377 from rintaro/ide-contextinfo
[SourceKit][IDE] New SourceKit request to retrieve context type information
2019-01-15 01:54:16 +09:00
iKichiemon
15f9ddcdb8 change enum SourceKitdError's case to lower camel case
- EditorOpenError to editorOpenError
- EditorCloseError to editorCloseError
2019-01-12 23:50:28 +09:00
Rintaro Ishizaki
3797b7a334 [SourceKit] New request to retrieve context type information
This is a new SourceKit request which receives a position in the source
file, returns possible expected types and their members which can be
referenced by "implicit member expression" syntax.
2019-01-11 00:49:57 +09:00
Parker Schuh
f5859ff46e Rename NameAliasType to TypeAliasType. 2019-01-09 16:47:13 -08:00
Ben Langmuir
db0e2738dc Merge pull request #21605 from DavidGoldman/sourcekit_invocation_error
[SourceKit] Use diagnostics for arg parsing
2019-01-09 08:54:42 -08:00
David Goldman
c2d0b4df6f Add removeConsumer to DiagnosticEngine 2019-01-08 17:28:54 -05:00
David Goldman
4651e14f09 Remove StreamDiagConsumer to prevent crash 2019-01-08 16:20:22 -05:00
Argyrios Kyrtzidis
ab7427723e [Parse/Syntax] Refactoring to decouple the parser from syntax tree creation
Instead of creating syntax nodes directly, modify the parser to invoke an abstract interface 'SyntaxParseActions' while it is parsing the source code.
This decouples the act of parsing from the act of forming a syntax tree representation.
'SyntaxTreeCreator' is an implementation of SyntaxParseActions that handles the logic of creating a syntax tree.
To enforce the layering separation of parsing and syntax tree creation, a static library swiftSyntaxParse is introduced to compose the two.

This decoupling is important for introducing a syntax parser library for SwiftSyntax to directly access parsing.
2019-01-07 19:52:59 -08:00
Brent Royal-Gordon
95e0c6614c [SourceKit] Add SwiftLang API to parse into ByteTree format
Redesigns the `SwiftLang.parse` API to accommodate a format parameter which can be used to request a ByteTree-serialized syntax tree instead of JSON-serialized. This gives us a convenient way to use the fastest currently available combination of tools for parsing a file into a syntax tree.

The new API only accepts paths, not source buffers, and returns JSON as `Data` instead of `String`, which are both better directions in the long run. The format type is extensible so that it can easily be extended to support "direct" parsing into a SyntaxSourceFile.

Deprecated wrapper methods with the old names and signatures are still available for any existing clients.
2019-01-04 10:36:39 -08:00
David Goldman
3c9f3c8815 SourceKit: Use actual diagnostics for arg parsing
With this change, you will no longer receive
"error when parsing the compiler arguments". Instead, you will
receive the underlying error, like
"error: unable to load output file map 'output_file_map.json': No such file or directory"
2019-01-03 11:10:31 -05:00
Argyrios Kyrtzidis
66be4a58b4 [Parser] Introduce ParserUnit::parse() function to avoid duplication of code 2018-12-16 09:52:15 -08:00
Saleem Abdulrasool
522f97da43 build: simplify the blocks handling
`-fblocks` is a core driver option now, so it can be used with both the GCC
style driver as well as the cl style driver.  Simplify the logic for the
handling of this option.
2018-12-07 08:24:19 -08:00
Argyrios Kyrtzidis
9694851c23 Merge pull request #21075 from akyrtzi/syntax-parser-cmake-prep
[CMake] Move cross-platform dispatch/blocks support to the tools level, in preparation for the syntax parser library
2018-12-06 09:35:52 -08:00
Argyrios Kyrtzidis
92377cc145 [CMake] Move cross-platform dispatch/blocks support to the tools level, in preparation for the syntax parser library 2018-12-05 22:41:39 -08:00
Xi Ge
5da65ac704 Merge pull request #21013 from nkcsgexi/doc-support
Sourcekit/DocSupport: include fully annotated generic signatures for extension decls.
2018-12-05 18:31:29 -08:00
swift-ci
39161d5b36 Merge pull request #20600 from adrian-prantl/36032653 2018-12-05 17:01:58 -08:00
Adrian Prantl
d63debeb60 Experimental: Extend ClangImporter to import clang modules from DWARF
When debugging Objective-C or C++ code on Darwin, the debug info
collected by dsymutil in the .dSYM bundle is entirely
self-contained. It is possible to debug a program, set breakpoints and
print variables even without having the complete original source code
or a matching SDK available. With Swift, this is currently not the
case. Even though .dSYM bundles contain the binary .swiftmodule for
all Swift modules, any Clang modules that the Swift modules depend on,
still need to be imported from source to even get basic LLDB
functionality to work. If ClangImporter fails to import a Clang
module, effectively the entire Swift module depending on it gets
poisoned.

This patch is addressing this issue by introducing a ModuleLoader that
can ask queries about Clang Decls to LLDB, since LLDB knows how to
reconstruct Clang decls from DWARF and clang -gmodules producxes full
debug info for Clang modules that is embedded into the .dSYM budle.

This initial version does not contain any advanced functionality at
all, it merely produces an empty ModuleDecl. Intertestingly, even this
is a considerable improvement over the status quo. LLDB can now print
Swift-only variables in modules with failing Clang depenecies, and
becuase of fallback mechanisms that were implemented earlier, it can
even display the contents of pure Objective-C objects that are
imported into Swift. C structs obviously don't work yet.

rdar://problem/36032653
2018-12-05 13:54:13 -08:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Xi Ge
d620dfae5e Sourcekit/DocSupport: include fully annotated generic signatures for extension decls. rdar://40906297 2018-12-04 14:29:28 -08:00
Xi Ge
7f7a756ea4 sourcekit: avoid evaluating pound conditions while perform syntactic parsing. rdar://46143404 2018-12-03 14:56:25 -08:00
swift-ci
cf1be5e644 Merge pull request #20427 from rockbruno/sourcekit-operators 2018-11-30 09:02:57 -08:00
Karoy Lorentey
36f048402f [SourceKit] SourceKitdUID: Implement hash(into:) rather than hashValue 2018-11-29 17:57:13 +00:00
Harlan Haskins
245109d909 Merge pull request #20250 from harlanhaskins/accessorizing
[ParseableInterface] Standardize printing for accessors
2018-11-27 10:31:17 -08:00
Harlan Haskins
a64a4e1940 [Sema] Add implicit @_hasStorage attribute for printing 2018-11-26 18:42:02 -08:00
Jordan Rose
6afe77ae98 [CMake] Clean up (somewhat) the generated Xcode project (#20586)
Still to do: have command-only targets that present sources, for things
like copy_shim_headers.
2018-11-26 11:31:41 -08:00