Commit Graph

3682 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis
1dc288fb23 Introduce C parser library
Add a shared library with a C API that provides access to the syntactic parser with callbacks for the inference of raw syntax nodes.
This is primarily intended to be used by SwiftSyntax to speed-up source code parsing for it.
2019-01-09 18:30:45 -08:00
Parker Schuh
f5859ff46e Rename NameAliasType to TypeAliasType. 2019-01-09 16:47:13 -08:00
Ben Langmuir
db0e2738dc Merge pull request #21605 from DavidGoldman/sourcekit_invocation_error
[SourceKit] Use diagnostics for arg parsing
2019-01-09 08:54:42 -08:00
David Goldman
c2d0b4df6f Add removeConsumer to DiagnosticEngine 2019-01-08 17:28:54 -05:00
David Goldman
4651e14f09 Remove StreamDiagConsumer to prevent crash 2019-01-08 16:20:22 -05:00
Argyrios Kyrtzidis
ab7427723e [Parse/Syntax] Refactoring to decouple the parser from syntax tree creation
Instead of creating syntax nodes directly, modify the parser to invoke an abstract interface 'SyntaxParseActions' while it is parsing the source code.
This decouples the act of parsing from the act of forming a syntax tree representation.
'SyntaxTreeCreator' is an implementation of SyntaxParseActions that handles the logic of creating a syntax tree.
To enforce the layering separation of parsing and syntax tree creation, a static library swiftSyntaxParse is introduced to compose the two.

This decoupling is important for introducing a syntax parser library for SwiftSyntax to directly access parsing.
2019-01-07 19:52:59 -08:00
Brent Royal-Gordon
95e0c6614c [SourceKit] Add SwiftLang API to parse into ByteTree format
Redesigns the `SwiftLang.parse` API to accommodate a format parameter which can be used to request a ByteTree-serialized syntax tree instead of JSON-serialized. This gives us a convenient way to use the fastest currently available combination of tools for parsing a file into a syntax tree.

The new API only accepts paths, not source buffers, and returns JSON as `Data` instead of `String`, which are both better directions in the long run. The format type is extensible so that it can easily be extended to support "direct" parsing into a SyntaxSourceFile.

Deprecated wrapper methods with the old names and signatures are still available for any existing clients.
2019-01-04 10:36:39 -08:00
David Goldman
3c9f3c8815 SourceKit: Use actual diagnostics for arg parsing
With this change, you will no longer receive
"error when parsing the compiler arguments". Instead, you will
receive the underlying error, like
"error: unable to load output file map 'output_file_map.json': No such file or directory"
2019-01-03 11:10:31 -05:00
Saleem Abdulrasool
bd05e2e5b7 sil-opt: fix a use-after-move on Windows
The order of argument evaluation is reversed on Windows, and the move is
evaluated prior to the stream being passed.  This is resulting in the
remarks file not being prepared for use.
2018-12-23 09:55:46 -08:00
Innovimax
335fe49b0e fix typo (#21473) 2018-12-20 21:37:55 -05:00
Michael Gottesman
fd4828e40a Eliminate -assume-parsing-unqualified-ownership-sil from tests.
I am doing this separately from the actual change to eliminate the option to
make it easier to review.
2018-12-19 12:54:13 -08:00
Argyrios Kyrtzidis
51bf7cc6ed Merge pull request #21362 from akyrtzi/parserunit-parse
[Parser] Introduce ParserUnit::parse() function to avoid duplication of code
2018-12-16 11:03:50 -08:00
Argyrios Kyrtzidis
66be4a58b4 [Parser] Introduce ParserUnit::parse() function to avoid duplication of code 2018-12-16 09:52:15 -08:00
Alex Langford
5d5d01a2fe [CMake] Require SWIFT_COMPONENT for add_swift_host_tool 2018-12-14 12:27:53 -08:00
Xi Ge
588391eb7e swift-api-digester: avoid synthesizing nominal types from the same module.
Synthesizing types from the same module may bring back types that are
not part the ABI/API, leading to false positives.

Resolves: SR-9372
2018-12-12 11:26:07 -08:00
Xi Ge
6fac47e7e6 swift-module-digester: non-final methods in fixed-layout classes no longer have fixed orders. rdar://46617463 2018-12-12 11:26:07 -08:00
Michael Gottesman
089e3a8ecd [cmake] tools/swift-reflection-test => stdlib/tools/swift-reflection-test.
If one thinks about it, swift's build has two sections: a runtime or target
section (i.e. ./stdlib) and a host section (everything
else). swift-reflection-test is an abberation from that pattern since it is
built for target platforms but is in the section of host tools.

In this commit, I move it into ./stdlib. Beyond being a bitter location
conceptually this will additionally allow me to avoid a dependency cycle in
between the compiler and the stdlib build.

After this, there is only one more target in the compiler code: swift-lang. From
talking with Xi Ge, we can move that into its own separate project as a
package. Once that is done, I will not have any more cycles.
2018-12-09 02:20:33 -08:00
Xi Ge
33c0b4f4b2 swift-module-digester: test -v mode when diagnosing ABI/API changes. 2018-12-07 14:23:19 -08:00
Saleem Abdulrasool
522f97da43 build: simplify the blocks handling
`-fblocks` is a core driver option now, so it can be used with both the GCC
style driver as well as the cl style driver.  Simplify the logic for the
handling of this option.
2018-12-07 08:24:19 -08:00
Argyrios Kyrtzidis
9694851c23 Merge pull request #21075 from akyrtzi/syntax-parser-cmake-prep
[CMake] Move cross-platform dispatch/blocks support to the tools level, in preparation for the syntax parser library
2018-12-06 09:35:52 -08:00
Argyrios Kyrtzidis
92377cc145 [CMake] Move cross-platform dispatch/blocks support to the tools level, in preparation for the syntax parser library 2018-12-05 22:41:39 -08:00
Xi Ge
5da65ac704 Merge pull request #21013 from nkcsgexi/doc-support
Sourcekit/DocSupport: include fully annotated generic signatures for extension decls.
2018-12-05 18:31:29 -08:00
swift-ci
39161d5b36 Merge pull request #20600 from adrian-prantl/36032653 2018-12-05 17:01:58 -08:00
Adrian Prantl
d63debeb60 Experimental: Extend ClangImporter to import clang modules from DWARF
When debugging Objective-C or C++ code on Darwin, the debug info
collected by dsymutil in the .dSYM bundle is entirely
self-contained. It is possible to debug a program, set breakpoints and
print variables even without having the complete original source code
or a matching SDK available. With Swift, this is currently not the
case. Even though .dSYM bundles contain the binary .swiftmodule for
all Swift modules, any Clang modules that the Swift modules depend on,
still need to be imported from source to even get basic LLDB
functionality to work. If ClangImporter fails to import a Clang
module, effectively the entire Swift module depending on it gets
poisoned.

This patch is addressing this issue by introducing a ModuleLoader that
can ask queries about Clang Decls to LLDB, since LLDB knows how to
reconstruct Clang decls from DWARF and clang -gmodules producxes full
debug info for Clang modules that is embedded into the .dSYM budle.

This initial version does not contain any advanced functionality at
all, it merely produces an empty ModuleDecl. Intertestingly, even this
is a considerable improvement over the status quo. LLDB can now print
Swift-only variables in modules with failing Clang depenecies, and
becuase of fallback mechanisms that were implemented earlier, it can
even display the contents of pure Objective-C objects that are
imported into Swift. C structs obviously don't work yet.

rdar://problem/36032653
2018-12-05 13:54:13 -08:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Xi Ge
d620dfae5e Sourcekit/DocSupport: include fully annotated generic signatures for extension decls. rdar://40906297 2018-12-04 14:29:28 -08:00
Xi Ge
a127d1bb9b Merge pull request #20981 from nkcsgexi/avoid-evaluate
sourcekit: avoid evaluating pound conditions while perform syntactic parsing. rdar://46143404
2018-12-03 15:52:33 -08:00
Xi Ge
7f7a756ea4 sourcekit: avoid evaluating pound conditions while perform syntactic parsing. rdar://46143404 2018-12-03 14:56:25 -08:00
Raj Barik
be0bdd14ce Merge pull request #20617 from rajbarik/raj-es-fix-default-enable
Fix ExistentialSpecializer bugs for swiftpm and enable existential-specializer for sil-opt
2018-12-03 11:10:09 -08:00
Raj Barik
c4df82baa8 ExistentialTransform fixes for swiftpm bugs and enable existential-specializer in sil-opt 2018-11-30 14:29:54 -08:00
swift-ci
cf1be5e644 Merge pull request #20427 from rockbruno/sourcekit-operators 2018-11-30 09:02:57 -08:00
Harlan Haskins
da3fe20b0a Merge pull request #20901 from harlanhaskins/the-front-fell-off
[FrontendTool] [NFC] Reduce scope of FrontendObserver
2018-11-29 20:23:02 -08:00
swift-ci
2ef35ac80e Merge pull request #19655 from apple/marcrasi-const-evaluator-part-1 2018-11-29 19:25:14 -08:00
Harlan Haskins
7b43e1d04d [FrontendTool] [NFC] Reduce scope of FrontendObserver
These APIs weren't used.
2018-11-29 19:18:56 -08:00
Karoy Lorentey
36f048402f [SourceKit] SourceKitdUID: Implement hash(into:) rather than hashValue 2018-11-29 17:57:13 +00:00
swift-ci
7f121bf2f7 Merge pull request #20843 from akyrtzi/api-checker-protocol-whitelist 2018-11-28 15:57:10 -08:00
Argyrios Kyrtzidis
2358c8944f [api-digester] For readFileLineByLine() ignore lines that are comments
Allows us to add informational comments in the text files that are used as inputs for the digester.
2018-11-28 15:34:36 -08:00
Argyrios Kyrtzidis
5e7327714f [api-digester] Add '-protocol-requirement-white-list' option to the digester for when diagnosing API breakage in SDKs
This option access a file that lists protocol names that are 'whitelisted' for getting new protocol requirements.
This allows the SDK checker to avoid flagging protocol method additions for protocols that we know are not intended
for user classes to conform to.
2018-11-28 15:01:39 -08:00
Argyrios Kyrtzidis
0413358f25 [api-digester] Don't report as API breaking when an ObjC protocol gets a new optional method 2018-11-28 11:59:20 -08:00
Harlan Haskins
245109d909 Merge pull request #20250 from harlanhaskins/accessorizing
[ParseableInterface] Standardize printing for accessors
2018-11-27 10:31:17 -08:00
Harlan Haskins
a64a4e1940 [Sema] Add implicit @_hasStorage attribute for printing 2018-11-26 18:42:02 -08:00
Marc Rasi
390daeaeea address comments 2018-11-26 17:25:21 -08:00
Jordan Rose
6afe77ae98 [CMake] Clean up (somewhat) the generated Xcode project (#20586)
Still to do: have command-only targets that present sources, for things
like copy_shim_headers.
2018-11-26 11:31:41 -08:00
swift-ci
69a4323072 Merge pull request #20655 from compnerd/linked-libraries 2018-11-16 20:53:11 -08:00
Saleem Abdulrasool
dd85d79105 tools: use target_link_libraries like clang (NFC)
Rather than using the `LINK_LIBRARIES` option, use target_link_libraries
like clang does.  Because these are all host tools, there is no name
mangling done for the libraries making this a no-op change.
2018-11-16 17:43:06 -08:00
Saleem Abdulrasool
df18445642 swift-reflection-test: correct typo in windows function name
Correct the spelling for the pipe function.  Windows prefixes the
remnant POSIX functions with `_`.  Fix the spelling to build on Windows.
2018-11-16 08:52:50 -08:00
swift-ci
8fb811262f Merge pull request #20577 from adrian-prantl/cl 2018-11-15 13:55:44 -08:00
Saleem Abdulrasool
e3e4d1ba0b tools: remove unnecessary LLVM_COMPONENT linkage
Remove the unncessary link against the DebugInfoCodeView component.  THe tools
seem to build without the dependency.  The dependency issue in the linkage
seems to have been resolved.
2018-11-14 18:29:19 -08:00
Adrian Prantl
7e6713ed76 Hide irreleveant command line options of lldb-moduleimport-test 2018-11-14 12:18:43 -08:00
Slava Pestov
a1ae75b2ba Merge pull request #20455 from slavapestov/fix-misc-regressions
Fix a handful of regressions
2018-11-09 13:20:44 -05:00