Commit Graph

3682 Commits

Author SHA1 Message Date
Xi Ge
d58c072ab7 Merge pull request #23394 from nkcsgexi/syntax-parser-opt
SyntaxParser: avoid evaluating pound conditions in the new in-process parser.
2019-03-18 13:47:47 -07:00
Xi Ge
a970d13d9f SyntaxParser: avoid evaluating pound conditions in the new in-process parser. 2019-03-18 12:09:22 -07:00
Michael Gottesman
0dfaa19f9f [ownership] Rename enable-sil-ownership => verify-sil-ownership.
I have been meaning to do this change for a minute, but kept on putting it off.
This describes what is actually happening and is a better name for the option.
2019-03-18 01:31:44 -07:00
Jordan Rose
22f9853b76 [ParseableInterface] Turn on -enable-parseable-module-interface always (#23331)
...and remove the option. This is ~technically~ CLI-breaking because
Swift 5 shipped this as a hidden driver option, but it wouldn't have
/done/ anything in Swift 5, so I think it's okay to remove.

Note that if a parseable interface (.swiftinterface) and a binary
interface (.swiftmodule) are both present, the binary one will still
be preferred. This just /allows/ parseable interfaces to be used.

rdar://problem/36885834
2019-03-16 15:31:11 -07:00
swift-ci
3ee1add5c3 Merge pull request #23333 from jmittert/CloseHandle 2019-03-15 15:36:38 -07:00
Gwen Mittertreiner
c45381d286 Windows: Close Handle after Resolving Symlinks
Calling resolvePathSymlinks twice on the same path failed with a sharing
exception due to the old handle still being help.
2019-03-15 12:24:20 -07:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
Xi Ge
35b17d7a6c SourceKit: allow expression type request to specify a list of protocol USRs for filtering
The client usually cares about a subset of all expressions. A way to differentiate
them is by the protocols these expressions' types conform to. This patch allows
the request to add a list of protocol USRs so that the response only includes those
interested expressions that conform to any of the input protocols.

We also add a field to the response for each expression type to indicate the
conforming protocols names that were originally in the input list.

When an empty list of protocol USRs are given, we report all expressions' types
in the file like the old behavior.

rdar://35199889
2019-03-13 14:07:33 -07:00
Saleem Abdulrasool
8ed5c1a4bc build: introduce and switch to GYB_SOURCES
This avoids us having to pattern match every source file which should
help speed up the CMake generation.  A secondary optimization is
possible with CMake 3.14 which has the ability to remove the last
extension component without having to resort to regular expressions.  It
also helps easily identify the GYB'ed sources.
2019-03-11 13:48:54 -07:00
Mike Ash
fbe990481b [Runtime] Dynamically select the is-Swift bit at runtime on Apple platforms.
Recent Swift uses 2 as the is-Swift bit when running on newer versions, and 1 on older versions. Since it's difficult or impossible to know what we'll be running on at build time, make the selection at runtime.
2019-03-07 10:12:27 -05:00
Xi Ge
98eadc8680 sourcekit/cmake: build swiftlang only when overlay is built
This is because swiftLang module needs foundation to build.
2019-03-06 18:52:40 -08:00
Jason Mittertreiner
24c10fe8f7 Fix Response Files on Windows (#22985)
This prevents response files on Windows from being overridden after they
are read.
2019-03-01 19:03:46 -08:00
Xi Ge
740b476dd9 Merge pull request #22992 from nkcsgexi/diagnostics-c-api
SwiftSyntax Parser: expose parser diagnostics via C API.
2019-03-01 18:30:48 -08:00
Xi Ge
a86f89da48 SwiftSyntax Parser: expose parser diagnostics via C API.
This allows SwiftSyntax to listen to emitted diagnostics during
parsing.

rdar://48439271
2019-03-01 15:22:21 -08:00
Xi Ge
dd7f52898f Doc: update protocol for expression type request after adopting custom buffer 2019-02-27 11:47:44 -08:00
Xi Ge
cca6fea65a Merge pull request #22835 from nkcsgexi/custom-buffer
sourcekitd: define a new custom buffer for expression type response.
2019-02-25 16:29:14 -08:00
Nathan Hawes
9bd39355b2 Merge pull request #22793 from nathawes/add-implicit-at-objc-attributes-to-index-request-output
[sourcekitd] Report entities that are implicitly @objc as @objc in the index request responses for compatibility
2019-02-25 16:21:44 -08:00
Xi Ge
e71b2a5f7f Merge pull request #22864 from compnerd/cl-digests-the-digester
swift-api-digester: use elaborated typename
2019-02-25 11:03:15 -08:00
Saleem Abdulrasool
1f7acb614d Merge pull request #22865 from compnerd/reflect-a-better-name
swift-reflection-dump: use elaborated type name
2019-02-25 10:31:30 -08:00
Saleem Abdulrasool
a2ff73fd9a swift-reflection-dump: use elaborated type name
cl is unable to differentiate between the `swift::ReflectionContext` and
`swift::reflection::ReflectionContext`.  Use the elaborated typename to
uniquely identify the type.  This allows us to build
`swift-reflection-dump` with cl again.
2019-02-24 15:40:00 -08:00
Saleem Abdulrasool
760ef4442a swift-api-digester: use elaborated typename
cl is unable to disambiguate between `swift::KnownProtocolKind` and
`swift::ide::api::KnownProtocolKind`.  Use the elaborated typename to
disambiguate the type.  This allows us to build `swift-api-digester`
with cl again.
2019-02-24 15:38:45 -08:00
Argyrios Kyrtzidis
05893a8595 Merge pull request #22831 from compnerd/cmake-modernise-1
cmake: switch host libraries to use `target_link_libraries`
2019-02-23 10:57:07 -08:00
Xi Ge
d006afc3c7 sourcekitd: update in-proc sourcekitd API. 2019-02-22 17:46:55 -08:00
Xi Ge
3fc52305a3 sourcekitd: define a new custom buffer for expression type response.
This custom buffer encapsulates the memory layout details of the response
for the expression type request. From the client side, each expression type
is represented as a tuple of {expr_offset, expr_length, printed_type}.

rdar://35199889
2019-02-22 16:58:10 -08:00
Nathan Hawes
7680cc6b16 [sourcekitd] Report entities that are implicitly objc as objc in the index request responses for compatibility
Members of an @objcMembers context previous had implicit @objc attributes, but
now don't (possibly because of the request evaluator changes?). This updates the
output of sourcekitd's 'index' request to act as if they still had implicit
@objc attributes on them for compatibility.

Resolves rdar://problem/48140265
2019-02-22 16:35:30 -08:00
Saleem Abdulrasool
9934532e07 cmake: switch host libraries to use target_link_libraries
This is a follow up to the discussion on #22740 to switch the host
libraries to use the `target_link_libraries` rather than the
`LINK_LIBRARIES` special handling.  This allows the dependency to be
properly tracked by CMake and allows us to use the more modern syntax.
2019-02-22 15:28:07 -08:00
Slava Pestov
3dc5ae36a6 SourceKit: Use Demangle::getTypeDeclForUSR() to implement 'CursorInfo for USR' request
Fixes <rdar://problem/47819208>.
2019-02-22 16:13:03 -05:00
Slava Pestov
c42c98c13e swift-ide-test: Use Demangle::getTypeDeclForUSR() to implement -type-reconstruction flag
"Fixes" <rdar://problem/30680565> -- the "reconstruct_type_from_mangled_name_invalid"
test has been disabled since 2017, and the output has changed a fair bit. But the
FIXMEs have been addressed and it can reconstruct the associated type and
type alias now, and there's no harm in re-enabling it now.
2019-02-22 16:13:02 -05:00
Slava Pestov
fd0e1cd640 swift-ide-test: Use Demangle::getTypeDeclForMangling() to implement -find-mangled flag 2019-02-22 16:13:02 -05:00
Slava Pestov
d0d5fbdf39 ASTDemangler: Introduce new getTypeDeclForMangling()
This will replace getDeclFromMangledSymbolName().

Progress on <rdar://problem/47819208>.
2019-02-22 16:13:02 -05:00
Slava Pestov
54ec06d13d Merge pull request #22792 from slavapestov/fix-remoteast-asan-failure
RemoteAST: Try to fix a use-after-free in swift-remoteast-test
2019-02-21 18:45:17 -05:00
Nathan Hawes
4ced0afd9e Merge pull request #22764 from nathawes/add-implicit-to-index-request-output
[sourcekitd] Expose the 'implicit' symbol role in the 'index' request response
2019-02-21 15:17:43 -08:00
Slava Pestov
82f8d3f2e9 RemoteAST: Try to fix a use-after-free in swift-remoteast-test
Fixes <rdar://problem/48067187>.

We keep a global context alive now, but we have to destroy it before
Swift's ASTContext is torn down.
2019-02-21 16:39:58 -05:00
Nathan Hawes
e5e9dc6c05 [sourcekitd] Expose the 'implicit' symbol role in the 'index' request response
Resolves rdar://problem/48148270.
2019-02-20 17:12:23 -08:00
Xi Ge
5601a9826e Merge pull request #22753 from nkcsgexi/request-type
SourceKit: Add a new request to collect expression types in a source file.
2019-02-20 14:44:27 -08:00
Mishal Shah
345e9881d1 Merge pull request #22699 from apple/stable-update-5.1
Update Swift:master to work with new stable re-branch from swift-5.1-branch
2019-02-20 12:22:00 -08:00
Xi Ge
934104a5a7 Docs/SourceKit: add some documentation for expression type request. 2019-02-20 10:52:50 -08:00
Xi Ge
74e86a8f35 SourceKit: Add a new request to collect expression types in a source file.
This request collects the types of all expressions in a source file after type checking.
To fulfill this task, the client must provide the path to the Swift source file under
type checking and the necessary compiler arguments to help resolve all dependencies.

Request:

{
    <key.request>:            (UID)     <source.request.expression.type>,
    <key.sourcefile>:         (string)  // Absolute path to the file.
    <key.compilerargs>:       [string*] // Array of zero or more strings for the compiler arguments,
                                        // e.g ["-sdk", "/path/to/sdk"]. If key.sourcefile is provided,
                                        // these must include the path to that file.
}

Response:

{
    <key.printedtypebuffer>:          (string)                    // A text buffer where all expression types are printed to.
    <key.expression_type_list>:       (array) [expr-type-info*]   // A list of expression and type
}

expr-type-info ::=
{
  <key.expression_offset>:    (int64)    // Offset of an expression in the source file
  <key.expression_length>:    (int64)    // Length of an expression in the source file
  <key.type_offset>:          (int64)    // Offset of the printed type of the expression in the printed type buffer
  <key.type_length>:          (int64)    // Length of the printed type of the expression in the printed type buffer
}

rdar:://35199889
2019-02-20 10:49:39 -08:00
Xi Ge
20e27f284a Merge pull request #22700 from nkcsgexi/ide-report-types
IDE: implement an IDE action to collect types of all expressions in a source file.
2019-02-18 19:50:44 -08:00
Xi Ge
84873fbbb3 IDE: implement an IDE action to collect types of all expressions in a source file.
This is libIDE side implementation for collecting all type information in a source
file. When several expression share the same source range, we always report the
type of the outermost expression.

rdar://35199889
2019-02-18 17:53:04 -08:00
Bob Wilson
213efe089c Merge commit '06120c9d9d1a28275a0ecd7466775b1d71716be7' into stable-update-5.1 2019-02-17 10:20:59 -08:00
David Zarzycki
6a53f67654 [CMake] Fix dependencies found using LLVM's -DBUILD_SHARED_LIBS=TRUE 2019-02-15 11:28:39 -05:00
Xi Ge
c93700aa8b Address several post-commit comments. NFC 2019-02-14 22:09:32 -08:00
Nathan Hawes
2ebd983cbd Merge pull request #22514 from nathawes/sourcekit-support-for-parseable-interfaces-pt-2
Fix sourcekitd interface generation crashing for modules that only have a .swiftinterface file
2019-02-14 09:57:21 -08:00
Xi Ge
bbdcb14c9c swiftlang: build type of swiftlang should agree with the standard library 2019-02-13 17:58:06 -08:00
Xi Ge
f5bcd7f1e6 Merge pull request #22594 from nkcsgexi/owner-syntax-parser
cmake: specify syntax parser's permission while installing the dylib
2019-02-13 15:23:45 -08:00
Nathan Hawes
d164c616b4 [ParseableInterface][sourcekitd] Set the DetailedPreprocessorRecord ClangImporter option on the sub invocation if it's set on the parent
In addition to capturing more detailed preprocessor info, the
DetailedPreprocessorRecord option sets the clang module format to 'raw'
rather than the default 'object'. Sourcekitd doesn't link the code
generation libs, which it looks like the default 'object' format requires,
so it sets this option to true. The subinvocation generated when loading a
module from a .swiftinterface file still used the default prior to this
change though, so it would end up crashing sourcekitd.

This change sets the DetailedProccessorRecord option if the DetailedRecord
option is set on the preprocessor options of parent context's clang module
loader. This fixes interface generation crashing for modules that only have
a .swiftinterface file.

rdar://problem/43906499
2019-02-13 14:13:25 -08:00
Nathan Hawes
6aad52aa6c Merge pull request #22550 from nathawes/code-complete-parseable-interface
[ParseableInterface] Fix failing to build a module when the importing file has errors.
2019-02-13 14:12:27 -08:00
Xi Ge
5493485b41 cmake: specify syntax parser's permission while installing the dylib 2019-02-13 14:03:27 -08:00
Rintaro Ishizaki
cf97dae9f1 [SourceKit] Fix memory issue in response construction for typecontextinfo
Buffer may be reallocated during the construction. We can't modify
buffer `SmallString` after getting 'StringRef' out of it.
2019-02-12 16:36:13 -08:00