Commit Graph

199 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
Michael Gottesman
d89f252deb Merge remote-tracking branch 'origin/master' into master-next 2016-04-18 02:26:06 -07:00
practicalswift
050023060a [gardening] Fix inconsistent spacing. 2016-04-15 21:05:52 +02:00
John McCall
21e9f5949a Merge remote-tracking branch 'origin/master' into master-next 2016-04-08 13:29:39 -07:00
practicalswift
abfecfde17 [gardening] if ([space]…[space]) → if (…), for(…) → for (…), while(…) → while (…), [[space]x, y[space]] → [x, y] 2016-04-04 16:22:11 +02:00
Xi Ge
ca93fa6d1b [SourceKit] DocInfo: Explicitly report the optionality of protocol members in response. rdar://25129725 2016-04-01 14:55:11 -07:00
Mark Lacey
b4787ffe79 Merge remote-tracking branch 'origin/master' into master-next 2016-03-31 16:15:11 -07:00
Xi Ge
37f5a0390a [SourceKit] DocInfo: Add a new entry to indicate the default implementation of a protocol member in its extensions. rdar://25032869 2016-03-30 14:26:17 -07:00
Saleem Abdulrasool
f0e06dffb5 build: add missing dependency
Add a dependency on LLVMCore to satisfy the link dependency.  Upstream changes
to the Target structure have caused a missing definition:

Undefined symbols for architecture ...:
  "llvm::DataLayout::~DataLayout()", referenced from:
      clang::TargetInfo::~TargetInfo() in libclangBasic.a(TargetInfo.cpp.o)
2016-03-26 02:01:19 -07:00
Xi Ge
fda0751cae [SourceKit] In interface-gen request, allow clients to send SourceKit an interested USR from which we can infer the group name. 2016-03-23 17:26:44 -07:00
Xi Ge
b3cde464dd [SourceKit] For consistency, using underscore instead of hyphen in recently introduced key names. NFC 2016-03-22 22:21:56 -07:00
Xi Ge
7c45425718 [SourceKit] When indexing modules, report group names for symbols.
We need this to support open-quickly for stdlib symbols.
2016-03-22 22:13:57 -07:00
Xi Ge
760c2f12cf [SourceKit] Update the way of representing USRs for synthesized extensions.
Instead of using 'key.usr' and 'key.synthesizedusr', we start to use 'key.usr' and 'key.original-usr' so
that 'key.usr' is consistently being the unique ID for a code entity.
2016-03-22 15:38:41 -07:00
Xi Ge
f338bdfbb7 [SourceKit] Incorporate synthesized extensions into DocInfo request. rdar://24912860
This commit reuses our code for generating synthesized extensions from module printing to enhance
documentation generation.
2016-03-22 14:49:22 -07:00
Xi Ge
3dd149ab99 [SourceKit] CursorInfo: The result of cursor info for a module name starts to include group names in that module. 2016-03-21 17:20:18 -07:00
Ben Langmuir
88c1065133 [CodeCompletion] Expose the existing option for whether to include exact matches
So we can play with it more easily.
2016-03-16 14:21:53 -07:00
Ben Langmuir
d36708838b [SourceKit] Allow cursorinfo to take a USR instead of an offset
This eventually calls the code from ReconstructType to try to find the
Decl for a USR. For now, only works in a file, not a generated
interface.

rdar://problem/25017817
2016-03-16 09:42:02 -07:00
Ben Langmuir
e17df9619b [SourceKit] Factor out wrapper code from reportCursorInfo
The guts of the callback are the interesting part that we want to share
between offset-based and usr-based cursor info. Pull the code that
actually finds the cursor info up into the caller.
2016-03-15 09:19:44 -07:00
Argyrios Kyrtzidis
56cbc4f740 [SourceKit] Avoid calling "sourcekitd::shutdown()" on the service side, when the connection closes.
No need to call sourcekitd::shutdown() since the process is going down
anyway, plus if we get a new connection before the process closes then
we will fail to re-initialize properly since the initialize call is at main.
2016-03-08 13:07:46 -08:00
Ben Langmuir
1a83912c4e [SourceKit] Add fully annotated declaration to DocInfo requests
Also expose the printing function as a SwiftLangSupport static method.
Ideally we could move this into libIDE, but it currently depends on the
UIdent visitor to get decl-specific tag names and it's not obvious how
we should hoist/abstract that out in a nice way.

rdar://problem/24292226
rdar://problem/24292304
2016-02-25 20:12:13 -08:00
Argyrios Kyrtzidis
10dfe5ab5a [SourceKit] Fix issue where the offset of diagnostic fixits is not updated after an edit request.
rdar://23919223
2016-02-19 19:18:44 -08:00
Argyrios Kyrtzidis
bda072bb85 [SourceKit] Introduce a request to force a 'crash' for testing purposes. 2016-02-19 11:48:15 -08:00
Argyrios Kyrtzidis
64185c7ea9 [SourceKit] Fix leak in 'CodeCompleteSetCustom' request.
rdar://23769190
2016-02-16 18:40:59 -08:00
Argyrios Kyrtzidis
bc21bbe806 [SourceKit] Add a 'mangle simple classes' request, intended to supersede _swift_mangleSimpleClass.
rdar://23525281
2016-02-16 18:32:46 -08:00