Commit Graph

2632 Commits

Author SHA1 Message Date
Rintaro Ishizaki 194a14346d [swift-syntax-test] Make VerifySyntaxTree a command line option (#15227)
Add `-verify-syntax-tree` option to `swift-syntax-test`.
Defaulted to `true`, can be disabled with `-verify-syntax-tree=false`
2018-03-14 14:05:25 +09:00
Nathan Hawes 9746a284cd Merge pull request #15135 from nathawes/rdar38314383-ignore-llvm-args-for-sourcekit-ast-manager-invocation
Clear any LLVMArgs when initializing the CompilerInvocation for SourceKit's ASTManager
2018-03-13 12:07:12 -07:00
Xi Ge ee36dbeda3 [WIP] SwiftSyntax: Implement APIs for Syntax nodes to calculate absolute positions. (#15097)
Syntax nodes are designed as reusable blocks to construct Swift source
code. For this reason, we don't track absolute position in each node;
instead, the absolute position should be calculated on the fly when
needed. We recently found absolute positions are useful to bridge with
sourcekitd, which typically speaks in the language of line, column and
offset. Therefore, this patch tries to add a computed
property on SyntaxNode to get its absolute position.

To compute the absolute position of a SyntaxNode from scratch requires tree traversal.
However, getting the absolute position from these added APIs doesn't necessarily
mean we'll traverse since SyntaxData will actively cache the computed position.
Also, since we recursively compute the absolute position, all the position caches
for a SyntaxNode's previous siblings and ancestors will be populated as well during
the calculation of this SyntaxNode.
2018-03-12 15:42:46 -07:00
Denis Morozov 6608176e13 Use RawSyntax presence state properties in SwiftSyntax 2018-03-12 15:35:29 -07:00
Sho Ikeda 422136e1a2 [gardening][enum class] Replace unsigned char with uint8_t for consistency
Before the changes:

- `git grep -E "enum class .+ : uint8_t \{" | wc -l`: 90
- `git grep -E "enum class .+ : unsigned char \{" | wc -l`: 26
2018-03-12 13:57:36 +09:00
Denis Morozov 568ae2deda Improve comments in Syntax.swift 2018-03-11 11:46:51 -07:00
Jordan Rose c26f40b45b Fix some more misuses of LLVM's YAML parser. (#15119)
https://reviews.llvm.org/D44317 should prevent this from happening
again.
2018-03-10 17:47:14 -08:00
Harlan 37a6f4c6ec [SwiftSyntax] Make traits conform to Syntax (#15112) 2018-03-10 09:39:35 -05:00
Nathan Hawes 17a6ef5c6e Clear any LLVMArgs when initializing the CompilerInvocation for SourceKit's ASTManager
SourceKit doesn't use them and if any unrecognised LLVM options are
passed to llvm::cl::ParseCommandLineOptions() it calls exit(), bringing
down SourceKit.

Also use fprintf instead of llvm::errs() in Logging.cpp as it uses a
global C++ object that had already been destructed when logging the
above failure.

Resolves rdar://problem/38314383
2018-03-09 18:56:57 -08:00
Michael Gottesman 43c167d7b0 [+0-normal-args] Make sure to use |= when enabling +0 in sil-opt.
Previously, we were just assigning from the llvm option. This made it impossible
to turn on +0 by default, since sil-opt would always assign false to the
SILOption... *doh*.

rdar://34222540
2018-03-09 17:30:29 -08:00
swift-ci 36b254df94 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-08 01:58:15 -08:00
Sho Ikeda 74ba135008 Merge pull request #15040 from ikesyo/gardening-not-empty
[gardening] Use `!empty()` over `size() > 0`
2018-03-08 18:47:12 +09:00
swift-ci 5c29024c43 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-07 21:38:10 -08:00
Harlan e41a42b060 [SwiftSyntax] Ensure SyntaxRewriter respects nil children when rewriting (#15052) 2018-03-08 00:37:41 -05:00
Bob Wilson b5b4b7946c Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-07 16:59:30 -08:00
Sho Ikeda cea6c03eb2 [gardening] Use !empty() over size() > 0 2018-03-08 09:21:09 +09:00
Xi Ge e61c8958fd SwiftSyntax: simply trivia implementation on the Swift side. 2018-03-07 16:19:09 -08:00
swift-ci d0093723bd Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-05 21:58:14 -08:00
Harlan d3f6b8743d [SwiftSyntax] Publicize DiagnosticEngine.addConsumer and add hasErrors property (#14996)
* [SwiftSyntax] Publicize DiagnosticEngine.addConsumer and add hasErrors property

* [Syntax] Make DiagnosticEngine.hasErrors public
2018-03-06 00:40:24 -05:00
swift-ci 4ddf5d4d95 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-05 15:18:21 -08:00
Xi Ge f66dd8e59c swift-api-digester: keep track of type declarations with fixed layout. (#14991)
We need special logic to check abi-stability for decls with fixed
layout.
2018-03-05 15:08:06 -08:00
swift-ci eade62b1c0 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-05 10:18:36 -08:00
Mike Ash a2d973dbbd Merge branch 'master' into remotemirror-hide-reflection-sections 2018-03-05 09:48:58 -05:00
swift-ci 149a29cb4d Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-03 15:57:51 -08:00
omochimetaru d12542503f [Syntax] test diagnostics in Lexer with libSyntax (#14954) 2018-03-04 08:53:54 +09:00
swift-ci abbca89fbf Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-02 18:19:18 -08:00
Xi Ge f77b318831 swift-api-digester: teach the tool to serialize raw type name for enum declarations. 2018-03-02 17:14:36 -08:00
swift-ci c5040f80ea Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-02 14:40:02 -08:00
Mike Ash 6c59410943 [ReflectionMirror] Change swift-reflection-test.c to use addReflectionInfo on non-Macho platforms. 2018-03-02 17:36:33 -05:00
Huon Wilson 78bdc95ce3 Merge pull request #14874 from huonw/at-owned-cleanup
Various refactorings for __owned.
2018-03-02 14:20:21 -08:00
Mike Ash 4852d57663 [RemoteMirrors] Don't use addImage in swift-reflection-dump, it doesn't work if the target bitness doesn't match our bitness. 2018-03-02 15:30:57 -05:00
Huon Wilson b94c5364f5 [NFC] Rename 'Ownership' to 'ReferenceOwnership'.
There's really two forms of ownership: references and values. Renaming
to make way for better distinguishing of the two.
2018-03-02 11:38:28 -08:00
Mike Ash 66fc743c80 Merge branch 'master' into remotemirror-hide-reflection-sections 2018-03-02 12:22:35 -05:00
Mike Ash 553ef86a4b [RemoteMirrors] Change MemoryReader::readBytes to return a unique_ptr instead of a tuple so that the destructor handles freeing the memory. 2018-03-02 12:05:36 -05:00
Mike Ash 1434fce417 [RemoteMirrors] Switch #ifdef __APPLE__ to #if defined(__APPLE__) && defined(__MACH__) to be more specific about the fact that this code is for MachO. 2018-03-02 11:03:45 -05:00
swift-ci 1386c0e9bc Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-01 15:59:52 -08:00
Xi Ge 66bb9ce4ba swift-api-digester: teach the tool to serialize conforming protocols. (#14923) 2018-03-01 15:57:59 -08:00
Mike Ash 7e9e476b58 Merge branch 'master' into remotemirror-hide-reflection-sections 2018-03-01 10:47:07 -05:00
swift-ci 1fc9db0035 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-28 22:40:32 -08:00
swift-ci 81c9f83a42 Merge pull request #14899 from nkcsgexi/sourcekit-async 2018-02-28 22:35:44 -08:00
swift-ci 9e935e1a9e Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-28 20:00:51 -08:00
Jordan Rose 3cd9f166bc Don't spend time initializing LLVM when running the driver (#14896)
Tiny start-up time optimization noticed while looking at how we do
PrettyStackTraceProgram. Also add PrettyStackTraceProgram to a few
more of our testing tools, via the new PROGRAM_START macro.
2018-02-28 19:56:19 -08:00
Xi Ge 2b464c8e61 SwiftSourceKit: Add an API for sending request asynchronously. NFC 2018-02-28 17:11:54 -08:00
Mike Ash c515c4c769 [RemoteMirrors] Restore findReflectionInfo in swift-reflection-dump for non-MachO platforms, to keep things working until we implement addImage for them. 2018-02-28 15:01:48 -05:00
swift-ci 78a4e268b3 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-28 11:41:18 -08:00
David Ungar 9cc534a05a Merge pull request #14702 from davidungar/PR-18-7-OutputsInInputs
[Batch mode]: Move SupplementaryOutputs into each InputFile and use the proper supplementary output. (7)
2018-02-28 11:31:47 -08:00
David Ungar 4866df6dfd Move SupplementaryOutputs into each InputFile. 2018-02-28 09:41:49 -08:00
swift-ci 7f99ae6c75 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-27 17:38:25 -08:00
Rintaro Ishizaki cbeacfdff5 Merge pull request #14803 from rintaro/sourcekit-offset-guard
[SourceKit] Add defensive guard for invalid offset
2018-02-28 10:21:37 +09:00
swift-ci de8b4acd2d Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-27 14:38:18 -08:00