Commit Graph

2308 Commits

Author SHA1 Message Date
Michael Gottesman
224d76391c [cmake] Follow LLVM/Clang's example and use add_llvm_subdirectory and invoke add_llvm_subdirectory when adding tools/libs. This allows us to selectively disable the building of tools by setting the variable SWIFT_{TOOL,LIB}_XXX_BUILD=OFF.
This is done by introducing the macros: add_swift_{lib,tool}_subdirectory.
2016-07-09 21:24:20 -07:00
Xi Ge
09a19bb230 [SourceKit] Avoid expanding the last argument as trailing closure if there are other closures in the tuple. rdar://23428366 (#3408)
SourceKit invariantly expands the last argument in a function call as trailing closure,
if it is of function type. However, there are situations when inline closures
are preferred; for example, when the last argument is not the only closure in the function
call. This patch modifies SourceKit so that when the argument contains multiple closures,
the last argument is expanded as inline closure.
2016-07-07 18:25:55 -07:00
Xi Ge
64efa48c65 [SourceKit][DocInfo] When the underlying type of a type alias decl exists, report the conformances of the underlying type. rdar://26408167 (#3394)
Showing only the conforming associated types provides
little information to doc viewers. This patch digs the
underlying type of an associated type to report the
conformance info of those.
2016-07-07 16:24:01 -07:00
Michael Gottesman
e25e0e4d39 Revert "[cmake] Do not set CMAKE_INCLUDE_CURRENT_DIR."
This reverts commit 3168df8c11.
2016-07-01 19:18:27 -07:00
Michael Gottesman
3c603ab18b Merge remote-tracking branch 'origin/master' into master-next 2016-07-01 18:44:21 -07:00
Harlan
1625d97976 Switch to llvm-profdata's pooled profdata merge (#3281) 2016-07-01 16:45:21 -07:00
Ben Langmuir
c8f7da4de1 [CodeCompletion] Support a narrow case for producing trailing closures directly
This adds a narrow special case in code-completion for control-flow-like
methods such as DispatchQueue().sync that are () -> (), to add a new
completion where the trailing closure is immediately expanded rather
than having to invoke placeholder expansion as a second step.

rdar://problem/26628804
2016-07-01 14:16:57 -07:00
shotat
4cead9bf7e Fix typos 2016-06-26 19:31:05 +09:00
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