Commit Graph

75 Commits

Author SHA1 Message Date
Artem Chikin
338b9141e3 Move libSwiftScan from 'tools' to 'lib/Tooling'
'tools' should be reserved for executable tools.
2024-11-14 08:44:32 -08:00
Steven Wu
034c15ce54 [Caching] Add new CacheReplay APIs to libSwiftScan
Add new APIs libSwiftScan that can be used for cache query and cache
replay. This enables swift-driver or build system to query the cache and
replay the compilation results without invocation swift-frontend for
better scheduling.
2023-11-03 15:59:56 -07:00
Erik Eckstein
e7af73e2de Replace the swift-llvm-opt binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:53:12 +02:00
Erik Eckstein
2b2bc45e08 Replace the swift-dependency-tool binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:51:04 +02:00
Erik Eckstein
8ce6038a42 Replace the sil-passpipeline-dumper binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:49:33 +02:00
Erik Eckstein
e3a174b85e Replace the sil-llvm-gen binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:48:23 +02:00
Erik Eckstein
bc7b632d3e Replace the sil-nm binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:47:13 +02:00
Erik Eckstein
b6132d10e5 Replace the sil-func-extractor binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:45:22 +02:00
Erik Eckstein
2e9c241034 Replace the sil-opt binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:44:04 +02:00
Rintaro Ishizaki
c4b3edd6df [Macros] Add swift-plugin-server executable
This executable is intended to be installed in the toolchain and act as
an executable compiler plugin just like other 'macro' plugins.

This plugin server has an optional method 'loadPluginLibrary' that
dynamically loads dylib plugins.
The compiler has a newly added option '-external-plugin-path'. This
option receives a pair of the plugin library search path (just like
'-plugin-path') and the corresponding "plugin server" path, separated
by '#'. i.e.

  -external-plugin-path
    <plugin library search path>#<plugin server executable path>

For exmaple, when there's a macro decl:

  @freestanding(expression)
  macro stringify<T>(T) -> (T, String) =
      #externalMacro(module: "BasicMacro", type: "StringifyMacro")

The compiler look for 'libBasicMacro.dylib' in '-plugin-path' paths,
if not found, it falls back to '-external-plugin-path' and tries to find
'libBasicMacro.dylib' in them. If it's found, the "plugin server" path
is launched just like an executable plugin, then 'loadPluginLibrary'
method is invoked via IPC, which 'dlopen' the library path in the plugin
server. At the actual macro expansion, the mangled name for
'BasicMacro.StringifyMacro' is used to resolve the macro  just like
dylib plugins in the compiler.

This is useful for
 * Isolating the plugin process, so the plugin crashes doesn't result
   the compiler crash
 * Being able to use library plugins linked with other `swift-syntax`
   versions

rdar://105104850
2023-03-16 14:00:45 -07:00
Rintaro Ishizaki
761cbb0ade [Macros] Add a library to make simple executable plugins for testing
Add `_swiftMockPlugin` library.
Usage:
  #include "swift/swift-c/MockPlugin/MockPlugin.h"

  MOCK_PLUGIN([
    {"expect": {...},
     "response: {...}}
  ])
2023-02-26 12:17:24 -08:00
QuietMisdreavus
8d548efbb9 install a list of symbols generated by the PrintAsClang header (#59072)
rdar://93504690
2022-12-09 16:38:02 -07:00
Robert Widmann
25a8655773 Delete swift-syntax-test and Syntax Unit Tests 2022-11-16 13:38:25 -08:00
Robert Widmann
2d07f382c5 Delete _InternalSwiftSyntaxParser And Its Build Infrastructure
This is the start of the removal of the C++ implementation of libSyntax
in favor of the new Swift Parser and Swift Syntax libraries. Now that
the Swift Parser has switched the SwiftSyntaxParser library over to
being a thin wrapper around the Swift Parser, there is no longer any
reason we need to retain any libSyntax infrastructure in the swift
compiler.

As a first step, delete the infrastructure that builds
lib_InternalSwiftSyntaxParser and convert any scripts that mention
it to instead mention the static mirror libraries. The --swiftsyntax
build-script flag has been retained and will now just execute the
SwiftSyntax and Swift Parser builds with the just-built tools.
2022-11-02 10:35:29 -07:00
Pavel Yaskevich
10b609caec [Localization] Remove YAML format and tool 2022-08-22 10:53:51 -07:00
Pavel Yaskevich
799fff6750 [Localization] Implement .def to .strings converter tool 2022-08-22 09:25:10 -07:00
Artem Chikin
d24e15812b Build libSwiftStaticMirror as a standalone library with minimal required dependencies.
This separates it from `libSwiftScan` and allows us to build this library without building much of the rest of the compiler.

Also refactor `utils/build-parser-lib` into `utils/build-tooling-libs` which builds both SwiftSyntaxParser and SwiftStaticMirror.
2022-02-09 12:28:21 -08:00
Connor Wakamo
3689d4c340 [CMake] Added support for disabling building the SourceKit XPC service.
Made `BUILD_SOURCEKIT_XPC_SERVICE` into an option so it can be set externally.
It continues to default to `TRUE` if `HAVE_XPC_H AND SWIFT_BUILD_SOURCEKIT` is
true, and `FALSE` otherwise, but this allows a client to disable this ahead of
time and build a sourcekitd.framework without the XPC service.

This addresses <rdar://problem/85511711>.
2021-12-03 15:59:25 -08:00
Michael Gottesman
872d492029 [cmake] Allow for users to build binaries for testing even if we aren't going to run the actual tests.
Previously, we used SWIFT_INCLUDE_TESTS to control if we created build rules for
binaries just used to test as well as running the tests as well. In this commit,
I changed this behavior by adding an option called SWIFT_INCLUDE_TEST_BINARIES.
This will allow for the stage 1 swift build to build and install test binaries
into the just built toolchain for use by the stage 2 swift that builds the
stdlib.
2021-09-01 16:33:04 -07:00
Owen Voorhees
77efd77d23 [APIDigester] Build the API digester as a frontend tool instead of a standalone executable 2021-03-10 19:30:10 -08:00
Argyrios Kyrtzidis
8cbfb545a2 [parser lib] A few enhancements for the syntax-parser-only build
* Make the `build-parser-lib` script more flexible on how it finds the llvm source path
* Make sure `swift-syntax-parser-test` can be built even though the script disables building for testing
* Fix a linker error for parser-only build
2021-02-26 08:39:24 -08:00
Artem Chikin
53e53db6c0 [Dependency Scanning] Factor the shared library libSwiftScan into tools and add exports file.
This library now relires on a static compiler library called `swiftDependencyScan`, which is also common to being used by `swift-frontend` for its dependency scanner invocations.
2021-01-07 09:08:20 -08:00
Butta
86c40574f5 [build] Don't build test targets in tools/ if SWIFT_INCLUDE_TESTS is turned off 2020-11-13 17:22:09 +05:30
Ben Langmuir
6701a33e5c [sourcekit] Enable installing both sourcekitdInProc and sourcekitd
Makes it possible to build and install both sourcekitdInProc and the XPC
service on Darwin.
2020-11-10 13:56:56 -08:00
HassanElDesouky
354440402f [Localization] Create swift-def-to-yaml-converter tool 2020-09-03 16:33:23 -07:00
HassanElDesouky
a84cf7f9e8 [Locale] Serialize YAML to an OnDiskHashTable format and create a tool for serialization 2020-08-05 15:52:46 -07:00
Saleem Abdulrasool
6ac810cb2d Merge pull request #32353 from compnerd/vars
build: remove unnecessary variable (NFC)
2020-06-12 15:46:44 -07:00
Saleem Abdulrasool
36dfd0d90b build: remove unnecessary variable (NFC) 2020-06-12 11:36:36 -07:00
Slava Pestov
4ff5dd4ed9 Dependencies: New swift-dependency-tool to convert between binary and YAML formats 2020-06-10 23:43:40 -04:00
Rintaro Ishizaki
8a03e08966 Revert "Merge pull request #26403 from rintaro/gsoc-2019-part1"
This reverts commit 1a211e6e5f, reversing
changes made to 482d0621a6.
2019-10-14 15:18:05 -07:00
Rintaro Ishizaki
27f2f3607c [CMakeFile] Speculative fix for build dependency issue 2019-07-30 00:30:16 -07:00
John McCall
d53a88d920 Stub out a tool that runs a script over a Swift AST.
The tool is currently hard-coded to find functions in the SwiftUI library that take parameters of type `(...) -> T` where `T: View` but where the parameter isn't annotated with `@ViewBuilder`.  The long-term vision here, of course, is that this reads and interprets a script file, but that's quite a bit more work (especially to generate a million bindings to the AST).  In the meantime, I think having a functional harness that people familiar with the C++ API can easily hack on to make their own tools is still pretty useful.

The harness does try to open a script file and lex the first token of it, because that's exactly as far as I got before deciding to hard-code the query I wanted.  Since this input is otherwise ignored, you can just point the tool at any old `.swift` file (or just an empty file) and it'll be fine.
2019-07-25 01:38:38 -04:00
Davide Italiano
3a17628611 [Reflection] Add an utility to stress test the metadata reader.
lldb now uses this quite extensively so we want to make sure
we don't crash on invalid.

<rdar://problem/49043621>
2019-03-21 10:34:33 -07:00
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
Saleem Abdulrasool
cdf0d19254 build: always build swift-reflection-dump
We always build swiftReflection now for the tools which allows us to
always build this tool.
2018-11-04 12:12:07 -08:00
Saleem Abdulrasool
9fc6b29e90 tools: remove swift-test-utils
This seems to have been introduced for SwiftSyntax which is no longer in
the tree.  No additional dependencies exist.  Clean up the dead code
which prevents cross-compilation of just the host tools.
2018-09-05 20:20:24 -07:00
Alex Hoppen
3801bb0e42 [SwiftSyntax] Remove SwiftSyntax from the main swift repository
It has moved to its own repository at https://github.com/apple/swift-syntax
2018-08-30 11:46:22 -07:00
Xi Ge
f7edb4cbee cmake: build swift-swiftsyntax-test only when SwiftSyntax is built. (#18558)
Resolves: rdar://43024275
2018-08-08 12:12:55 -07:00
Xi Ge
d1e02604fa SwiftSyntax: make Swift test utilities build on linux. (#18496) 2018-08-07 15:40:01 -07:00
Xi Ge
571b29b64f SwiftSyntaxTest: refactor command-line argument parsing into a test utility module. NFC (#18418) 2018-07-31 17:05:47 -07:00
Xi Ge
8f687714a2 SwiftSyntax: set up a test executable that can access SwiftSyntax APIs.
This will serve as the same functionality as swift-ide-test, but for
Swift syntax clients.
2018-07-19 18:18:30 -07:00
Michael Gottesman
cdbaf9074f [demangle] Add a new tool called swift-demangle-yamldump.
This is a separate tool so we can use all of LLVM without worrying about
creating a dependency from the demangler on LLVM's libsupport.

I am going to use it to fix cmpcodesize for the new mangling by eliminating
cmpcodesize's usage of regex to classify symbols. Instead, we can just read in
the yaml version of the symbol trees for each demangled node and process that
instead.

rdar://41146023
2018-06-20 13:47:25 -07:00
Davide Italiano
98292f4277 [tools] Add a libfuzzer based swift demangler fuzzer.
The debugger demangles names pretty often and we would like
to ensure it never crashes.
2018-05-04 17:31:35 -07:00
Saleem Abdulrasool
c79d8e069b build: repair the -SourceKit build
It is possible to disable the SourceKit build.  However, we would
unconditionally add dependencies on targets which would only be
generated when SourceKit was being built, resulting in CMake failing to
configure.  Restore the ability to disable the SourceKit build.
2018-02-13 10:00:26 -08:00
Xi Ge
69bbf2ba71 sourcekitd: using gyb to generate UIDs instead of a def file. NFC (#14549)
Inspired by the infrastructure of SwiftSyntax, a gyb file can facilitate
cross-language sharing.
2018-02-12 22:48:54 -08:00
Xi Ge
2e03eac75c [WIP] Re-apply "SwiftSyntax: Teach SwiftSyntax to use SourceKitd to serialize syntax trees. (#14424)" (#14506)
After removing white space changes and attempting to configure dependencies
correctly.
2018-02-11 09:38:53 -08:00
Doug Gregor
774bee2294 Revert "Re-apply "SwiftSyntax: Teach SwiftSyntax to use SourceKitd to serialize syntax trees. (#14424)" (#14465)"
This reverts commit f8c77e17ce.
2018-02-08 22:58:45 -08:00
Xi Ge
f8c77e17ce Re-apply "SwiftSyntax: Teach SwiftSyntax to use SourceKitd to serialize syntax trees. (#14424)" (#14465) 2018-02-08 15:11:31 -08:00
Xi Ge
50cde06cf0 Revert "SwiftSyntax: Teach SwiftSyntax to use SourceKitd to serialize syntax trees. (#14424)" 2018-02-06 23:20:42 -08:00
Xi Ge
871c9dac2a SwiftSyntax: Teach SwiftSyntax to use SourceKitd to serialize syntax trees. (#14424)
When using SwiftSyntax as a standalone tool, we invoke Swiftc
internally to get serialized syntax trees. This is not ideal for
several reasons: (1) we have to hard-code the relative path of swiftc
to invoke it; (2) we have to rely on standard input/output to pass the
tree across the process boundaries; and (3) we have to maintain two
different ways to get syntax tree (swiftc and sourcekitd).

This patch attempts to teach SwiftSyntax to use SourceKitd to get the
tree just like other clients. We first add a SourceKitd client library
written in Swift; and next teach SwiftSyntax to adopt this SourceKitd
client-side library. For platforms other than MacOS, we still use Swiftc
to get syntax trees. This client library also allows us to add 
SourceKitd tests in Swift.

This patch also re-enables several flaky tests.
2018-02-06 19:40:16 -08:00