Commit Graph

2350 Commits

Author SHA1 Message Date
Michael Gottesman
e90ae448c8 [upstream-update] Fix one last usage of llvm::sys::PrintStackTraceOnErrorSignal. 2016-06-25 02:24:48 -07:00
Michael Gottesman
d3467b40ca Merge pull request #3008 from compnerd/stack-trace
[master-next] update invocation of PrintStackTraceOnError
2016-06-25 02:15:22 -07:00
Michael Gottesman
8d00a6cb59 Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	stdlib/public/SDK/GameplayKit/CMakeLists.txt
	test/DebugInfo/bound-namealiastype.swift
	test/DebugInfo/structs.swift
	test/IRGen/c_globals.swift
	test/SourceKit/DocSupport/doc_clang_module.swift
	test/SourceKit/Indexing/index_with_clang_module.swift
	utils/update-checkout
2016-06-25 01:13:50 -07:00
Michael Gottesman
3168df8c11 [cmake] Do not set CMAKE_INCLUDE_CURRENT_DIR.
Setting this value is equivalent to setting:

include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

in all subdirectories. Since these are all macros, this means that we are adding to the configuration
path the root swift directory. There is no reason to do this and will result in
confusion/bugs in the future.

rdar://26154980
2016-06-24 19:14:34 -07:00
Michael Gottesman
5d984de9ec [cmake] Instead of setting LLVM_TABLEGEN_EXE, use our own SWIFT_TABLEGEN_EXE variable.
This eliminates us setting an LLVM_ prefixed variable in a situation where there is
a viable alternative.

We want to eliminate as many of these as possible since they can cause conflicts
with variables set in LLVMConfig.cmake.

I also added some convenience tablegen functions in AddSwiftTableGen.cmake and
changed all tblgen users to use that instead.

rdar://26154980
2016-06-24 17:18:45 -07:00
Brian Croom
2c4eb846fd [SourceKit] Add an in-proc implementation of sourcekitd API functions.
Darwin can use the XPC implementation of this even for the in-proc library
build, this alternative implementation is need for Linux where XPC services
are not available.

This implementation is derived from the existing XPC one but replaces XPC
services' object model with a basic class hierarchy providing
reference-counted objects for the value types and collections that
compose the sourcekitd API's request and response types.
2016-06-24 17:43:54 -04:00
swift-ci
3ea89df9d0 Merge pull request #3163 from briancroom/sourcekit-shared-object-printer 2016-06-23 20:55:51 -07:00
Brian Croom
5a300033f5 [SourceKit] Share common object printer code
This is an attempt to clean up code duplication around printing SourceKit
request and response objects.
2016-06-23 18:37:18 -04:00
practicalswift
e78e7e4c3c [gardening] Fix recently introduced typos. 2016-06-23 16:42:48 +02:00
Brian Croom
af0fd68a6e [SourceKit] Clean up clang dependency ordering 2016-06-22 21:00:12 -04:00
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