Commit Graph

2340 Commits

Author SHA1 Message Date
swift-ci
202e991e99 Merge pull request #3101 from briancroom/sourcekit-break-circular-dependency 2016-06-22 13:25:32 -07:00
Brian Croom
fac744067c [SourceKit] Remove dependency of SwiftLang on Core 2016-06-22 13:04:37 -04:00
Saleem Abdulrasool
0dfeee7871 SourceKit: use _WIN32 instead of LLVM_ON_WIN32
`_WIN32` indicates if we are targeting Windows or not.  Directly use that macro
rather than `LLVM_ON_WIN32` used by LLVM.  This makes it easier to port the
code.
2016-06-22 06:32:46 -07:00
Ben Langmuir
f72bd5453f [CodeCompletion] Fix a crash when completing typealiases for protocol conformance
The index may be at the end of the ArrayRef of chunks if the completion
ends with a simple parameter with no type annotation.  Check that the
index is in-bounds before adding text.

rdar://problem/26273906
2016-06-21 16:56:29 -07:00
Ben Langmuir
3c9c52010b [CodeCompletion] Add image and color literals to results
Surface these results in the codecomplete code path (they're already
there in the codecomplete.open code path) so we can use them from IDEs.
For now, just use ad-hoc filtering to show them when the type matches
(or there is no expected type).  Ideally we would make this filtering
configurable like we do in the codecomplete.open code path.

rdar://problem/25836544
2016-06-21 11:41:15 -07:00
Brian Croom
67edb44990 Merge pull request #3085 from briancroom/sourcekit-semaphore
[SourceKit] Add Semaphore to SourceKitSupport's concurrency module
2016-06-21 13:56:23 -04:00
Brian Croom
479584109c [SourceKit] Add Semaphore to SourceKitSupport's concurrency module
Includes a libdispatch-based implementation.
2016-06-21 13:54:41 -04:00
Brian Croom
a406858e38 Merge pull request #3096 from briancroom/sourcekitd-api-common
[SourceKit] Move some functions into sourcekitdAPI-Common.
2016-06-21 04:48:11 -04:00
Brian Croom
194a583ac7 [SourceKit] Move some functions into sourcekitdAPI-Common.
These functions are not XPC-specific and can be treated as part of the
common implementation.
2016-06-20 10:39:52 -04:00
Brian Croom
6c1f8dd6d6 [SourceKit] Only build sourcekitd-repl if a unicode-aware libedit is present 2016-06-20 10:35:51 -04:00
Saleem Abdulrasool
e3c2c863d1 stdlib: define WIN32_LEAN_AND_MEAN and NOMINMAX
`WIN32_LEAN_AND_MEAN` prevents "rarely-used" headers from being pulled in.  This
significantly reduced preprocessor pressure, speeding up compile.  It also
reduces the amount of cruft pulled in by the Windows.h.

`NOMINMAX` ensures that the `min` and `max` macros are not defined.  These
macros collide with the use of `min` and `max` from C++ in certain cases: e.g.
`std::limits<T>`.
2016-06-16 07:34:17 -07:00
Dmitri Gribenko
e15861a66e Merge pull request #3017 from practicalswift/python
[gardening] Use consistent capitalization for "Python".
2016-06-14 21:29:05 -07:00
Mishal Shah
87b7bcfd3e Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-06-14 14:53:55 -07:00
practicalswift
db6890fd26 [gardening] Use consistent capitalization for "Python". 2016-06-14 23:18:00 +02:00
Saleem Abdulrasool
9846299697 update invocation of PrintStackTraceOnError
SVN r272232 added an additional parameter to PrintStackTraceOnError.  Update the
use of the API to add the executable name.  We can assume that argv[0] will
always be provided as that is the name of the binary itself.
2016-06-13 14:49:53 -07:00
Brian Gesiak
3dc42d77a9 Merge pull request #2789 from modocache/sourcekitd-test-missing-request-types
[SourceKit] Update sourcekitd-test request types
2016-06-13 13:16:57 -04:00
Brian Gesiak
227fab9ee6 Merge pull request #2766 from modocache/sourcekit-linux-link-swiftlang
[SR-1639][SourceKit] Link SwiftLang libraries to sourcekitd
2016-06-13 13:05:57 -04:00
Michael Gottesman
61df461e88 [lto][cmake] Add LTO support to SourceKit.
rdar://24717107
2016-06-10 13:33:49 -07:00
swift-ci
2ae71e9297 Merge pull request #2763 from modocache/sourcekitd-repl-in-proc 2016-06-07 11:42:55 -07:00
Ben Langmuir
4600b1dd12 [CodeCompletion] Fix incorrect upper bound for assertion
This assertion was bogus if there were fewer results than N.
2016-06-04 18:22:18 -07:00
therealbnut
2f4aed7bb2 Fix some CMakeLists syntax 2016-06-04 06:44:10 +10:00
Brian Gesiak
0154875f81 [SourceKit] Update sourcekitd-test request types
The error message doesn't list all the possible request types that are
supported. For now, update the error message.
2016-05-31 15:38:35 -04:00
Brian Gesiak
2ed349c165 [SR-1639][SourceKit] Link SwiftLang libraries to sourcekitd
When building SourceKit on Linux, sourcekitdAPI would not be linked to
SourceKitSwiftLang, which caused the following symbols to be undefined:

- `SourceKit::LangSupport::SynthesizedUSRSeparator`
- `SourceKit::LangSupport::createSwiftLangSupport(SourceKit::Context&)`

Link SourceKitSwiftLang to resolve these symbols.
2016-05-29 01:21:07 -04:00
Brian Gesiak
8840510480 [SourceKit] Conditionally use in-proc for repl
Most SourceKit build products are linked against either
sourcekitd (which uses XPC) or sourcekitdInProc (which
does not) based on the `SWIFT_SOURCEKIT_USE_INPROC_LIBRARY`
CMake option. Adapt `sourcekitd-repl` to fit this established
pattern.
2016-05-29 00:27:26 -04:00
Brian Gesiak
d7e2e1f93e [SR-1613][SourceKit] Require blocks runtime
SourceKit makes heavy use of blocks. In order to port SourceKit to Linux,
we either need to rewrite much of it to use function pointers, or we must
require a blocks runtime. This commit requires a blocks runtime, but only
when SourceKit is being built. Currently, SourceKit is not built on Linux,
so this should not affect anyone.
2016-05-25 17:17:32 -04:00
Ben Langmuir
122350d450 [CodeCompletion] Apply filter rules directly to inner results
... and don't try to filter the extended results.  Once the results are
extended with the common prefix they will not match identifier filter
rules, which will create differences between completions depending on
whether they had a filter text or were a postfix expression.  Also,
allow filtering by name directly on the inner operator name for inner
operators.

rdar://problem/26312235
2016-05-25 12:07:17 -07:00
Ben Langmuir
5615b38040 [CodeCompletion] Show 'return' completion by default when appropriate
Ideally we would have precise completion for all our keywords; for now,
just imporove handling of 'return', which we can do by checking if the
current context is a function/closure/init/subscript/etc.

rdar://problem/26307555
2016-05-24 11:01:22 -07:00
Dmitri Gribenko
60a594f946 Merge pull request #2467 from modocache/sourcekit-linux-cmake
[SourceKit] Register optional sources in CMake
2016-05-10 18:32:35 -07:00
Brian Gesiak
d7020d8bb0 [SourceKit] Add missing includes
`ThreadSafeRefCntPtr.h` references `std::enable_if` and `std::move`,
but does not include `<type_traits>` or `<utility>`. This results
errors when compiling on Linux.
2016-05-10 17:10:29 -04:00
Brian Gesiak
ba75fea7dd [SourceKit] Add missing std::atomic include
`UIdent.h` references `std::atomic`, but does not include
`<atomic>`. This results in an error when compiling on Linux.
2016-05-10 17:07:06 -04:00
Brian Gesiak
4e72e21cf0 [SourceKit] Add missing std::string include
`SwiftInvocation.h` references `std::string`, but does not include
`<string>`. This results in an error when compiling on Linux.
2016-05-10 17:05:32 -04:00
Brian Gesiak
7cd74279f1 [SourceKit] Register optional sources in CMake
LLVM's CMake modules include a function `llvm_process_sources()`,
which (among other things) verifies that all source files in a
directory are either included in the list of source files to process,
or are included in a list `LLVM_OPTIONAL_SOURCES`.

SourceKit's CMake functions make use of this LLVM function, but do
not register any files as "optional". When attempting to configure
CMake to include SourceKit on a Linux host machine, source files
that are only included on Darwin host machines cause this function
to raise an error.

Mark Darwin-only SourceKit files as "optional" to avoid the error.
2016-05-10 16:36:35 -04:00
Xi Ge
2210effad2 [SourceKit] Avoid synthesizing extensions if group names are not given. rdar://26198267 2016-05-10 12:07:11 -07:00
Argyrios Kyrtzidis
910269dd20 Merge pull request #2455 from modocache/sourcekit-docs-test-candidate
[docs] Add SourceKit's `is_test_candidate`
2016-05-10 11:49:20 -07:00
Ben Langmuir
c77af6907e [CodeCompletion] Switch filter-rules and popular api to follow SE-0021 naming
We want inputs for function names to follow SE-0021 with the exception
that a function with no arguments is spelled `foo()` instead of `foo`,
because we have no type to disambiguate with and it's not ambiguous with
a call in this context.

Internally, we use a filter name without underscores because we don't
want to introduce spurious matches to the `_` character which might be
part of identifiers.

For now, continue to accept the old names to ease the transition.

rdar://problem/24350800
2016-05-10 11:13:46 -07:00
Ben Langmuir
b4ce34aba9 [CodeCompletion] Remove ... and & from function filter names
The filter name of a function should match the spelling of the function
name according to the language except that we don't insert _ for unnamed
parameters because underscores are legal inside identifiers and we don't
want to introduce spurious matches (also, we keep the () on a
parameterless function for disambiguation).

rdar://problem/26118915
2016-05-10 11:13:45 -07:00
Brian Gesiak
4e0358bfb0 [docs] Add SourceKit's is_test_candidate
When indexing, SourceKit finds methods that match what XCTest considers
to be a test; see: 197875ab6d/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp (L889-L890).
Document this behavior.
2016-05-09 21:29:23 -04:00
practicalswift
96772358a8 [gardening] Fix recently introduced typo: "propogated" → "propagated" 2016-05-08 09:01:06 +02:00
Brian Gesiak
fb8c5f1ff2 [SR-1421][SourceKit] Remove misleading help text
`sourcekitd-test` does not use LLVM's command line parsing utilities at
all, except to print a help message. However, the help message is
misleading: by default `llvm::cl` explains the `-help`, `-help-hidden`,
and `-version` options are available, but `sourcekitd-test` does not support
any of those.

https://bugs.swift.org/browse/SR-1421 tracks improving
`sourcekitd-test` help output, which will most likely involve migrating
it to LLVM's command line library. In the meantime, remove the
misleading "help" message.

Also, it should be noted that the return value of `1` returned after
printing the help message is not actually translated into a non-zero
exit code for the program. Add a "FIXME" to track the issue for now.
2016-05-07 11:31:43 -07:00
Argyrios Kyrtzidis
ec042460fe [SourceKit] Report attributes of decls for the indexing request. 2016-05-05 16:44:34 -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
af21c7d4b1 [SourceKit] Move UIDsFromDeclAttributes function to SwiftLangSupport header so it can be re-used, NFC. 2016-05-05 16:44:34 -07:00
Brian Gesiak
cfeece9f07 [docs] Spruce up Protocol docs for "docinfo" (#2401)
Modify the documentation for `source.request.docinfo` to match the
format of the rest of the documentation: "Request", "Response", and
"Testing".
2016-05-04 22:44:11 -07:00
Brian Gesiak
8c759f6468 [SourceKit] Convert Protocol docs to Markdown (#2392)
- Convert `Protocol.txt` to `Protocol.md`, and use valid Markdown
  syntax.
- Spruce up the documentation in the "code completion": more details on
  how to test via the REPL, clearer sentences, etc.
- Fix an error in which `sourcekitd-test -req=complete -offset=<offset>`
  used the incorrect option `-cc-offset`.
2016-05-04 16:25:06 -07:00
Mark Lacey
0f2c30f92a Add LLVMCoverage to one of the test builds to unbreak things. 2016-05-04 14:54:12 -07:00
Mark Lacey
590cd6476e Link LLVMCoverage into tools that pull in references to it. 2016-05-03 21:41:54 -07:00
Mark Lacey
182b6dfb18 Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	tools/driver/CMakeLists.txt
	tools/swift-reflection-dump/swift-reflection-dump.cpp
2016-05-03 14:23:20 -07:00
Ben Langmuir
69967ca45c [CodeCompletion] Identify known operators and force a fixed sort order
In the new code-completion code path, force any known operators to go
through a fixed sort order. To identify operators unambiguously, add a
new BuiltinOperator code-completion kind to handle non-decl operators
(!, ., ?., and =).

rdar://problem/25994246
rdar://problem/23440367
2016-05-03 10:23:13 -07:00
Ben Langmuir
f1ba846c78 [CodeCompletion] Swap the exact-match if one is a better case-sensitive match
Instead of just taking the first one, consider whether there is a better
result because of case-sensitivity.

rdar://problem/25994202
2016-05-03 10:23:12 -07:00
Ben Langmuir
ad34f89d5b [index] Add UnitTest SymbolSubKind and collapse the IndexSymbol inheritance
Fold UnitTest into the subkind, now that it's a bitself, and then remove
the unnecessary inheritance for IndexSymbol and its SourceKit indexing
equivalent.
2016-04-29 19:04:27 -07:00