Граф коммитов

42 Коммитов

Автор SHA1 Сообщение Дата
Cornelius Riemenschneider 79094e4b89 Swift genrule: Replace local with no-sandbox.
This allows the bazel cache to cache this genrule invocation.
It shouldn't depend on system-specific binaries, so
I believe this is correct.
This is the only part of our build where we otherwise
need to recompute parts after pulling in a full cache.
2024-03-21 13:51:22 +00:00
Cornelius Riemenschneider d2e6746e7f Upgrade to bazel 7.0.2. 2024-02-22 17:51:17 +01:00
Paolo Tranquilli b7df26e6c9 Bazel: make `codeql` compatible with workspace setup 2024-02-22 15:50:02 +01:00
Paolo Tranquilli 0787cc5e51 Merge branch 'main' into redsun82/bzlmod 2024-02-19 15:07:42 +01:00
Paolo Tranquilli 164250186a
Merge pull request #15593 from github/redsun82/swift-prebuilt-update
Swift: update swift prebuilt package
2024-02-19 15:05:13 +01:00
Paolo Tranquilli f842eee784 Swift: use `includes` in `picosha2` 2024-02-19 14:06:18 +01:00
Paolo Tranquilli ccf7608850 Swift: update swift prebuilt package 2024-02-19 13:47:53 +01:00
Paolo Tranquilli 2311e1c5ab Swift: remove test sdk
The test sdk that we were prebuilding to run ql tests is actually not
needed, as the `resource-dir` we package for cross-version compatibility
is enough for running qltests as well.
2024-02-19 13:28:48 +01:00
Paolo Tranquilli 19bb8fe22d Bazel: use bzlmod 2024-02-12 10:55:40 +01:00
Alex Denisov 0e73531aa9 Swift: upgrade to 5.9.2 2024-01-09 09:23:32 +01:00
Alex Denisov bbde709b3f Swift: upgrade to 5.9.1 2023-11-07 13:40:28 +01:00
Paolo Tranquilli 567aa1102a Swift: fix toolchain SHAs 2023-10-31 16:20:58 +01:00
Paolo Tranquilli bc34374075 Swift: switch to downloading the 20.04 toolchain 2023-10-31 16:20:58 +01:00
Paolo Tranquilli e25a655509 Swift: fix Linux compatibility problem and fetch resource dir from toolchain
This fetches the resource directory directly from the released
toolchains, allowing us to stop prebuilding and assembling them.
Moreover insertion of our resource directory is moved to the lua
tracing configuration (solving a `TODO`) and enhanced. Now all options
that start with the original resource directory (either explicit or
implied) are redirected to our resource directory.

This solves a problem where `-I <original resource dir>/some/path` was
passed to the extractor and did not work.

This works around the 5.9 linux compatibility problem by including the
`PackageDescription` swift modules in the in-dist toolchain. Copying the
toolchain and fixing the `-I` flag was not enough as for some reason
compilation of `PackageDescription.swiftinterface`  was causing a crash
in the SIL pass. We work around that by pre-compiling those modules
during the build and  including `.swiftmodule` files in the resource
directory.

TODO (apart from testing):
* the libraries included in the macOS toolchain are now fat (they were
  intel only before), occupying more space. We should see if we need to
  trim them down.
* there might be other swiftinterface files causing problems on linux
  lurking around...
* if we go with this, we can simplify and trim down the prebuilding we
  do leaving out the resource directory.
2023-10-31 16:20:58 +01:00
Alex Denisov c517fc6c6f Swift: 5.9 preparation 2023-07-06 14:02:37 +02:00
Alex Denisov d744b218f6 Misc: add bazel buildifer pre-commit hook 2023-06-30 13:07:04 +02:00
Alex Denisov dbdd654465 Swift: bump Swift build, NFC 2023-06-28 12:11:17 +02:00
AlexDenisov 9094f9aa9c
Merge pull request #13567 from github/alexdenisov/extend-observer
Swift: extend frontend observer
2023-06-28 09:35:27 +02:00
Paolo Tranquilli 6352399645 Swift: fix all upstream headers for C++20 2023-06-28 08:25:29 +02:00
Alex Denisov af41dabc14 Swift: extend the frontend observer 2023-06-27 16:57:44 +02:00
Paolo Tranquilli 592e7f0b56 Swift: add TODO for later swift updates 2023-06-19 15:52:16 +02:00
Paolo Tranquilli 3ff7148147 Swift: remove `std::result_of` from swift headers
`std::result_of` was removed in C++20, though the actual removal from
the STL library implementations seems to depend on the version. For
example using xcode 14.2 one gets away with a deprecation warning, but
xcode 14.3 will fail.

As Swift 5.8.1 is still compiled with C++14, we cannot replace
`std::result_of` with `std::invoke_result` in the prebuilding patches
just yet, but we can do that for the extractor itself, patching the
prebuilt package.
2023-06-19 15:29:45 +02:00
Alex Denisov 93b9115217 Swift: package resource dir from precomiled toolchain 2023-06-14 16:17:44 +02:00
Paolo Tranquilli 396b57696c Swift: minimal 5.8 compatibility 2023-06-14 16:17:44 +02:00
Paolo Tranquilli 3f2a059b3b Swift: add location support to TSP diagnostics
This required a bit of an overhaul of the original integration of
JSON diagnostics into binlog.

The problem is that it is quite hard to add a kind of metadata to
binlog entries without changing its code. Another problem is that when
wanting to avoid double evaluation of logging macro arguments one
cannot really add a separate "diagnose" step easily.

The proposed solution consists in two things:
* hook into a binlog plumbing function by providing a better overload
  resolution match, which happens after logging macro expansion,
  bypassing the problem of double evaluation
* in that hook, produce the diagnostic directly, without waiting to
  reconstruct the diagnostics entry from the binlog serialized entry.

This allows to forgo the weird category to diagnostic mapping, and now a
diagnostics emission simply happens when a diagnostic source is given
as the first argument after the log format string. A flavour of
diganostics sources with locations is then added with the same
mechanism, allowing to write something like
```cpp
LOG_ERROR("[{}] ouch!", internalError.withLocation("foo.swift", 32));
```
2023-05-11 17:52:02 +02:00
Paolo Tranquilli b5c0cd8cac Swift: remove unused third party build file 2023-05-04 12:18:02 +02:00
Paolo Tranquilli 8873e42cb1 Swift: removed unused `date` dependency 2023-05-03 16:02:26 +02:00
Paolo Tranquilli c7c12a7108 Swift: add json and date dependencies 2023-05-03 14:32:30 +02:00
Paolo Tranquilli 6c932bc807 Swift: address logging review comments 2023-04-04 10:28:11 +02:00
Paolo Tranquilli ed48065c2d Swift: add logging infrastructure 2023-04-03 11:47:23 +02:00
Paolo Tranquilli aaea976cf2 Swift: remove labels from function type printing 2023-03-20 16:43:34 +01:00
Paolo Tranquilli c4c9fd72bb Swift: update to 5.7.3
No changes to the Swift frontend library headers, so no changes to the
extractor seem to be required.
2023-02-17 10:03:52 +01:00
Paolo Tranquilli a1161c6efe Swift: remove header patch which is not needed any more 2022-12-20 15:28:52 +01:00
Paolo Tranquilli 45c0c7fe6c Merge branch 'main' into redsun82/swift-open-redirection 2022-12-14 18:26:16 +01:00
Alex Denisov ee94849528 Swift: switch to bootstrapped Swift compiler 2022-12-13 13:59:13 +01:00
Paolo Tranquilli d35c5e90ee Swift: remove fishhook 2022-12-08 16:10:44 +01:00
Paolo Tranquilli 944adfe727 Swift: allow modifying frontend outputs 2022-12-08 16:10:25 +01:00
Paolo Tranquilli 219ed64b74 Swift: reorganize bazel third party dependencies 2022-12-08 16:10:25 +01:00
Alex Denisov 0bfe502bb0 Swift: remove patches from the extractor
Moved elsewhere https://github.com/dsp-testing/codeql-swift-artifacts/pull/3
2022-11-30 15:36:09 +01:00
Paolo Tranquilli 9731048836 Swift: remove an `assert` from swift headers
An interesting byproduct was finding a problematic `assert` in the
Swift headers. An incomplete `FallthroughStmt` was asserting on having
a destination. I did not find any other sensible way of getting rid of
the crash when running in debug mode than to patch the header.
2022-11-08 11:47:12 +01:00
Paolo Tranquilli 521e6235b5 Swift: use `std::filesystem` and picoSHA2
This replaces usages of `llvm::fs` and string manipulation with
`std::filesystem`, also replacing `std::string` with
`std::filesystem::path` where it made sense.

Moreover MD5 hashing used in macOS file remapping was replaced by
SHA256 hashing using a small header-only SHA256 C++ library with an
MIT license, https://github.com/okdshin/PicoSHA2.

File contents hashing was relocated to the newly created `file` library
for later planned reuse.
2022-10-26 13:23:44 +02:00
Paolo Tranquilli c8788bb5cd Swift: move libraries from `tools` to `third_party` 2022-10-26 07:05:56 +02:00