Commit Graph

784 Commits

Author SHA1 Message Date
Ben Langmuir
773cd93812 Merge pull request #16042 from benlangmuir/sourcekitd-warnings
[sourcekitd] Fix some compiler warnings
2018-04-19 22:00:43 -07:00
Ben Langmuir
0aa11cb6b2 [sourcekitd] Fix some compiler warnings
* remove nullability attribute from a non-pointer argument
* const-correctness on custom buffer casts
* remove statically unreachable code
2018-04-19 14:27:08 -07:00
Ben Langmuir
23ab43c941 [sourcekitd] Change compile notifications to pass a single args string
... instead of an array of compiler arguments. This is good enough
for seeing what's going on, and it saves significant time for long
argument strings, because it doesn't create and destroy so many
xpc strings, and more of the string copying that happens is on a large
contiguous string instead of many small strings.

rdar://39538847
2018-04-19 13:59:27 -07:00
Ben Langmuir
31eae3675b [sourcekitd] Remove XPCTracing
This code was an experiment in how to collect information after a crash,
that did not end up being used.  It's unclear how much it has bitrotted
at this point, since it has no tests and was not designed with automated
testing in mind.  Parts of it interfere with some changes I want to make
to the underlying tracing mechanism, so I am finally removing it.  This
also lets us remove the buffer copying in the parts of tracing used by
the compile notifications, improving performance.

For rdar://39538847
2018-04-19 11:52:38 -07:00
Ben Langmuir
b78daf5959 [sourcekitd-test] Add options to repeat a request and ignore its output
This provides a very rudimentary way to check the end-to-end performance
of simple sourcekitd requests. A sample invocation might be

```
sourcekitd-test -time-request -repeat-request=10 -dont-print-response -req= ...
```
2018-04-19 10:46:07 -07:00
Ben Langmuir
94140763da [sourcekitd-test] Add a flag -time-request
Allows simple timing of request. Includes only the time to make the
request and receive the reply, but not any additional deserialization
etc.
2018-04-19 10:43:46 -07:00
Ben Langmuir
a30ba5e4ab [sourcekitd-test] Print requests more consistently
Fixes request printing for format and syntax-map+edit requests.
2018-04-17 13:28:28 -07:00
Ben Langmuir
e08c31759e [sourcekit] Remove dead UID value
This was renamed at some point and the usage in complete-test has become
dead anyway, so clean it up.
2018-04-13 13:49:57 -07:00
Rintaro Ishizaki
ad3e6b9471 [SourceKit] Make sourcekitd-test -req=demangle STDIN mode actually work
This didn't work at all because it didn't advance cursor after regex
matching.
Align regex with swift-demangle.
2018-04-11 20:08:52 +09:00
Rintaro Ishizaki
e9988589fb [SourceKit] Update demangle for new mangling
Use 'swift::Demangle::isSwiftSymbol()' instead of homemade function

rdar://problem/39286958
2018-04-11 20:08:27 +09:00
Argyrios Kyrtzidis
3156180c08 [SourceKit] For the XPC service identifier, also include the platform name
This is useful because the embedded platforms may have the same toolchain version but they contain
different stdlibs. We need to make sure the XPC service name is unique between them, otherwise we may load
and use the incorrect toolchain service.

rdar://39077520
2018-04-10 11:24:55 -07:00
Ben Langmuir
969f0f41f4 [sourcekitd] Capture diagnostics with invalid locations for compile notifications
Stop filtering out diagnostics with invalid locations in the editor
diagnostic consumer, and instead capture them separately so that we can
include them in did-compile notifications.

rdar://39225000
2018-04-06 11:36:01 -07:00
Ben Langmuir
cc51a8778f [sourcekitd] Remove dead method for checking invalid loc diagnostics 2018-04-05 16:02:32 -07:00
Ben Langmuir
10f21c77f3 Merge pull request #15641 from benlangmuir/compile-note-diags
[sourcekit] Add diagnostics to compile notification callback
2018-03-30 17:20:32 -07:00
Ben Langmuir
8c4c1863fc [sourcekit] Include diagnostics from code-completion in notification
The only interesting change here is that I stopped filtering out
non-note diagnostics from outside the "inputs".  This matches better how
code-completion gets inputs, and shouldn't hurt anything else since only
the tracing code will look at diagnostics that aren't in specific
buffers anyway.

rdar://38438512
2018-03-30 16:33:19 -07:00
Ben Langmuir
b78987a8c5 [sourcekit] Add diagnostics to compile notification callback
Compilations can now pass captured diagnostics as part of the
did-compile notification, and this was added to the SwiftASTManager.

rdar://38438512
2018-03-30 16:07:51 -07:00
Ben Langmuir
d8bb7d1c44 [sourcekitd-test] Synchronize notification printing
Notifications that we want to print for testing (e.g. with FileCheck)
are now buffered and drained explicitly from the queue that performs
requests.  This should prevent output intervleaving and ensure that we
actually print all the notifications that have been posted before
exiting (observed as rare test failures).

rdar://39048773
2018-03-30 15:31:33 -07:00
Ben Langmuir
8c78533e57 [sourcekit] Factor out common code for serializing diagnostics
Other than the extra field for the diagnostic stage in the editor
diagnostic handler, this code was byte-for-byte identical.
2018-03-30 10:19:29 -07:00
Ben Langmuir
79d641d89b [sourcekit] Add optional compile notifications
When enabled, send a notification before/after every "compilation",
which for now means `performSema`. This piggy-backs and modifies some
existing code that we had for "tracing" operations in sourcekitd that
unfortunately was untested.  At least now some of the basic parts are
tested via the new notifications.

Part of rdar://38438512
2018-03-29 14:59:30 -07:00
Ben Langmuir
38963ce883 [sourcekit] Tweak traced operation to be single-operator per RAII object
This is how it was used in all but one place anyway, and makes it easier
to understand.  It also aligns better with some further refactoring I
want to do...
2018-03-29 14:05:57 -07:00
Harlan
527cce409a [Syntax] Don't pretty-print -emit-syntax JSON output (#15380) 2018-03-27 10:55:59 -04:00
Doug Gregor
b2b69e8abf Rename BoundNameAliasType to NameAliasType.
NameAliasType is dead! Long live NameAliasType!
2018-03-25 21:35:17 -07:00
Doug Gregor
c43f96a855 [AST] Remove now-unused NameAliasType. 2018-03-25 21:35:16 -07:00
Argyrios Kyrtzidis
4dcfae7d39 Merge pull request #15440 from akyrtzi/sourcekitd-swift-version-as-string
[SourceKit] For the swift header interface request, accept the swift version as a string
2018-03-23 10:16:21 -07:00
Argyrios Kyrtzidis
455e87bd96 [SourceKit] For the swift header interface request, accept the swift version as a string
This is so we can pass the version as "4.2".

rdar://38673625
2018-03-22 16:32:24 -07:00
Doug Gregor
253bd10bd3 Cope with BoundNameAliasType in more places that handle NameAliasType. 2018-03-21 23:49:33 -07:00
Ray Fix
ac1f785b5f [SourceKit] Use WriteableMemoryBuffer to do the const_cast dirty work.
Based on PR feedback from @CodaFi
2018-03-19 00:05:51 -07:00
Ray Fix
055fa926be [SourceKit] Fix compiler warning.
Use const_cast instead of C style cast.
2018-03-18 18:09:56 -07:00
Nathan Hawes
60a6c02328 Merge pull request #15301 from nathawes/rdar38550117-range-info-on-comment-mark-crashing
[refactoring] fix RangeInfo crash inside comment, due to unhandled invalid CharSourceRange
2018-03-16 14:46:10 -07:00
Nathan Hawes
ff76c265f3 [refactoring] fix RangeInfo crash inside comment, due to unhandled invalid CharSourceRange.
Resolves rdar://problem/38550117
2018-03-16 11:24:44 -07:00
Slava Pestov
34fd4ae512 AST: Use DeclBaseName::Kind::Constructor
Fixes <rdar://problem/35852727>, <https://bugs.swift.org/browse/SR-1660>,
<https://bugs.swift.org/browse/SR-6557>.
2018-03-16 00:25:56 -07:00
Slava Pestov
615d068d63 Sema: Replace some uses of getBaseIdentifier() with userFacingName() 2018-03-14 22:26:58 -07:00
Nathan Hawes
9746a284cd Merge pull request #15135 from nathawes/rdar38314383-ignore-llvm-args-for-sourcekit-ast-manager-invocation
Clear any LLVMArgs when initializing the CompilerInvocation for SourceKit's ASTManager
2018-03-13 12:07:12 -07:00
Sho Ikeda
422136e1a2 [gardening][enum class] Replace unsigned char with uint8_t for consistency
Before the changes:

- `git grep -E "enum class .+ : uint8_t \{" | wc -l`: 90
- `git grep -E "enum class .+ : unsigned char \{" | wc -l`: 26
2018-03-12 13:57:36 +09:00
Nathan Hawes
17a6ef5c6e Clear any LLVMArgs when initializing the CompilerInvocation for SourceKit's ASTManager
SourceKit doesn't use them and if any unrecognised LLVM options are
passed to llvm::cl::ParseCommandLineOptions() it calls exit(), bringing
down SourceKit.

Also use fprintf instead of llvm::errs() in Logging.cpp as it uses a
global C++ object that had already been destructed when logging the
above failure.

Resolves rdar://problem/38314383
2018-03-09 18:56:57 -08:00
swift-ci
36b254df94 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-08 01:58:15 -08:00
Sho Ikeda
cea6c03eb2 [gardening] Use !empty() over size() > 0 2018-03-08 09:21:09 +09:00
swift-ci
1fc9db0035 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-28 22:40:32 -08:00
Xi Ge
2b464c8e61 SwiftSourceKit: Add an API for sending request asynchronously. NFC 2018-02-28 17:11:54 -08:00
swift-ci
78a4e268b3 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-28 11:41:18 -08:00
David Ungar
9cc534a05a Merge pull request #14702 from davidungar/PR-18-7-OutputsInInputs
[Batch mode]: Move SupplementaryOutputs into each InputFile and use the proper supplementary output. (7)
2018-02-28 11:31:47 -08:00
David Ungar
4866df6dfd Move SupplementaryOutputs into each InputFile. 2018-02-28 09:41:49 -08:00
swift-ci
7f99ae6c75 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-27 17:38:25 -08:00
Rintaro Ishizaki
3f232e753b [SourceKit] Add defensive guard for invalid offset
Invalid offset used to cause a inifinite loop in Lexer in some race
condition.

This is a quick fix until we fix underlying problem in SourceKit.
2018-02-27 18:14:52 +09:00
swift-ci
e4ad5c4de1 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-22 20:38:46 -08:00
Xi Ge
89fc1302c3 sourcekitd: duplicate sourcekitd UIDs should fail the build. (#14796)
This ensures we can safely add new UIDs.
2018-02-22 20:32:19 -08:00
swift-ci
2cd2bec970 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-21 14:55:39 -08:00
John Fairhurst
677491fc9b [SourceKit] Add syntaxtype for #error/#warning (#14742) 2018-02-21 14:48:18 -08:00
swift-ci
eabaa8bcf2 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-16 17:39:11 -08:00
Xi Ge
10eae689bf sourcekid: rename SwiftSourceKitClient to swift-lang. NFC (#14687)
This way the name of the source directory agrees with the module being
built.
2018-02-16 17:24:23 -08:00