Commit Graph

2340 Commits

Author SHA1 Message Date
Ben Langmuir
5ef19576a7 Merge pull request #4313 from rintaro/cc-attribute-colon
[Code Completion] Suffix ": " instead of "=" when completing attribute argument names
2016-08-16 13:38:38 -07:00
Rintaro Ishizaki
81c1edee5d [CodeCompletion] Suffix ": " instead of "=" when completing attribute argument names
In addtion, renamed DeclAttrParamEqual to DeclAttrParamColon.
2016-08-17 02:33:04 +09:00
Michael Gottesman
b3819c6783 [cmake] Rename COMPONENT_DEPENDS to LLVM_COMPONENT_DEPENDS (#4311)
Now that I am going to be adding an IN_SWIFT_COMPONENT argument, I need to do
this to distinguish the concepts of an LLVM_COMPONENT and a SWIFT_COMPONENT.
2016-08-16 12:13:34 -04:00
Dmitri Gribenko
f6035ff7e4 Merge pull request #3862 from RLovelett/bugfix/typo-in-sourcekitd-test
[SourceKit] Fix typo in sourcekitd-test error handler response
2016-08-04 13:06:28 -07:00
John McCall
afdda3d107 Implement SE-0117.
One minor revision: this lifts the proposed restriction against
overriding a non-open method with an open one.  On reflection,
that was inconsistent with the existing rule permitting non-public
methods to be overridden with public ones.  The restriction on
subclassing a non-open class with an open class remains, and is
in fact consistent with the existing access rule.
2016-08-02 07:46:38 -07:00
Ryan Lovelett
1384a394ed [SourceKit] Fix typo in sourcekitd-test error handler response
Currently if you type in a malformed `pos` argument it responds with:

    wrong pos format, it should be '<line>:<column'

After the change it responds with:

    wrong pos format, it should be '<line>:<column>'
2016-07-29 11:50:00 -04:00
Ryan Lovelett
54bb4084b2 [SourceKit] Add a table of contents and format tweak
- Make the Demangle header match the other headers in the doc (e.g.,
  double hash)
- Add a table of contents that is sorted alphabetically by request key
  with a link to the header in the document
2016-07-27 21:37:40 -04:00
Ryan Lovelett
9432de218f [SourceKit] Document source.request.cursorinfo 2016-07-27 21:03:16 -04:00
Ryan Lovelett
e6a1a8c541 [SourceKit] Document source.request.protocol_version 2016-07-27 21:02:40 -04:00
John McCall
c8c41b385c Implement SE-0077: precedence group declarations.
What I've implemented here deviates from the current proposal text
in the following ways:

- I had to introduce a FunctionArrowPrecedence to capture the parsing
  of -> in expression contexts.

- I found it convenient to continue to model the assignment property
  explicitly.

- The comparison and casting operators have historically been
  non-associative; I have chosen to preserve that, since I don't
  think this proposal intended to change it.

- This uses the precedence group names and higherThan/lowerThan
  as agreed in discussion.
2016-07-26 14:04:57 -07:00
Jordan Rose
508e825ff2 Split 'fileprivate' and 'private', but give them the same behavior.
'fileprivate' is considered a broader level of access than 'private',
but for now both of them are still available to the entire file. This
is intended as a migration aid.

One interesting fallout of the "access scope" model described in
758cf64 is that something declared 'private' at file scope is actually
treated as 'fileprivate' for diagnostic purposes. This is something
we can fix later, once the full model is in place. (It's not really
/wrong/ in that they have identical behavior, but diagnostics still
shouldn't refer to a type explicitly declared 'private' as
'fileprivate'.)

As a note, ValueDecl::getEffectiveAccess will always return 'FilePrivate'
rather than 'Private'; for purposes of optimization and code generation,
we should never try to distinguish these two cases.

This should have essentially no effect on code that's /not/ using
'fileprivate' other than altered diagnostics.

Progress on SE-0025 ('fileprivate' and 'private')
2016-07-25 13:13:35 -07:00
practicalswift
7e89679404 [gardening] Fix recently introduced typos. 2016-07-24 22:32:40 +02:00
Ben Langmuir
350441d1e3 Fix ThreadSafeRefCountedBase*::Release()
C++ atomic's fetch_sub returns the previous value, where we want to
check the new value. This was causing massive memory leaks in SourceKit.

For ThreadSafeRefCountedBase, just switch to the one in LLVM that's
already correct.  We should move the VPTR one to LLVM as well and then
we can get rid of this header.

rdar://problem/27358273
2016-07-21 16:25:44 -07:00
swift-ci
035823591a Merge pull request #3620 from nkcsgexi/syntax-kind 2016-07-21 03:14:23 -07:00
swift-ci
b8603b806f Merge pull request #3649 from benlangmuir/context-match-rebalance 2016-07-20 22:08:51 -07:00
Argyrios Kyrtzidis
488e335dc0 Merge pull request #3594 from jpsim/sourcekit-link-libdispatch
[SourceKit] Link with libdispatch & libswiftCore on Linux
2016-07-20 22:05:13 -07:00
Ben Langmuir
f962e74017 [CodeCompletion] Rebalance match score and semantic context
The high weight on semantic context turns out to give a lot of
unreasonable completions on common types. For example
  [0].ma<here>
was suggesting withUnsafeMutable... over map.

rdar://problem/27393776
2016-07-20 16:37:58 -07:00
Alex Hoppen
4aa6485ba0 [Printer] Rename ArchetypeTransformer to TypeTransformer
The ArchetypeTransformer isn't actually limited to transforming archetypes
but can transform arbitrary types. Thus, we can rename it to TypeTransformer
2016-07-20 10:55:50 +02:00
Luke Larson
74e0498015 Revert "Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs."
This reverts commit 62d1fa760c.
2016-07-19 15:18:17 -07:00
Xi Ge
195c737b54 [libIDE] Add syntax kind of argument to fix a crash. rdar://27377118
Argument used to have the same syntax kind with that of parameter. This patch
starts to differentiate them.
2016-07-19 15:10:46 -07:00
Mishal Shah
62d1fa760c Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-07-19 22:31:34 +02:00
Ben Langmuir
15cf72be20 [sourcekit] Fix use-after-free of block inside libsourcekitdInProc sync_request
In sourcekitdInProc, we were doing a by-ref capture of a block that
didn't live as long as the asyncronous callback. Fix it by capturing
by-copy.

Found by ASan!
2016-07-19 12:59:04 -07:00
Brian Gesiak
183cb54838 [SourceKit] Document source.request.demangle (#3603) 2016-07-19 10:45:56 -07:00
JP Simard
d3d211b154 link libswiftCore when building SourceKit on Linux
since libdispatch now includes a Swift overlay
2016-07-19 10:11:11 -07:00
Xi Ge
2a860100a5 [SourceKit] Implement a new SourceKit request to generate the interface for a given type. rdar://27306890 (#3586)
This patch allows SourceKit to generate the interface for a given type specified by its mangled name.
Type interface is refined decl printing with type parameters localized and unusable members hidden.

Required field:
   "key.request": "source.request.editor.open.interface.swifttype"
   "key.usr": the mangled name of the given type.
2016-07-18 18:05:47 -07:00
Brian Croom
d1d7525497 [SourceKit] Rename Concurrency-Mac.cpp to Concurrency-libdispatch.cpp
This file builds fine as long as libdispatch is available, even on
non-Darwin platforms.
2016-07-18 16:17:49 -07:00
Brian Croom
e109cb8285 [SourceKit] Add libdispatch as a dependency for some SourceKit products
sourcekitdInProc, sourcekitd-test, and complete-test need to be explicitly
linked with libdispatch on Linux to build properly.
2016-07-18 16:17:49 -07:00
Mark Lacey
1c00ac4c6d Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	lib/IRGen/IRGen.cpp
	test/DebugInfo/parent-scope.swift
2016-07-15 19:23:53 -07:00
Ben Langmuir
18be066651 [sourcekit] Synchronize cursor-info requests on generated interfaces
Cursor info requires access to the underlying AST, which is not
thread-safe. This manifest as crashes when performing concurrent
cursor-info requests on the same generated interface. We already
prevented concurrent cursor-infos on regular Swift files by using the
ASTManager, but generated interfaces use the InterfaceGenContext which
may use either an ASTUnit or its own internal CompilerInstance.

rdar://problem/27311624
2016-07-13 16:35:23 -07:00
Ben Langmuir
8e0ff518d1 [sourcekitd-test] Add -async flag to request options
This enables testing asyncronous requests on platforms that support it
(currently you need blocks support to call sourcekitd_send_request).
The implementation performs all -async requests and then at the end
handles all the responses in the order they were performed (possibly
blocking until they complete).

Also add a -dont-print-request flag to avoid printing request objects;
printing is fairly slow and makes it much harder to hit timing-sensitive
races, etc.
2016-07-13 16:35:22 -07:00
Xi Ge
a7e4cfd042 [SourceKit] Report container type USRs in the response to cursor-info request.
Typically, users jump to type-specific interface from a member of that type, for
instance, a.getSomething(). To generate the interface, we need to report the USR
of the container type of "getSomething()", which is the USR for the type of a,
 when cursor info is requested for this function call.
2016-07-12 15:50:18 -07:00
Xi Ge
a5e51a3494 [SourceKit] In CursorInfo response, include the mangle name of the type of the underlying decl.
The mangled name of the type is identical to those for debugger. These
mangled names allow us to reconstruct the type from AST and generate interface
specifically for that type.

Related rdar://27306890
2016-07-12 13:10:58 -07:00
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