Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

**Features**

- Updated libswift demangle to v6.3.1. ([#980](https://github.com/getsentry/symbolic/pull/980))

## 13.0.0

**Features**
Expand Down
3 changes: 0 additions & 3 deletions symbolic-demangle/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ fn main() {
.files(&[
"src/swiftdemangle.cpp",
"vendor/swift/lib/Demangling/Context.cpp",
"vendor/swift/lib/Demangling/CrashReporter.cpp",
"vendor/swift/lib/Demangling/Demangler.cpp",
"vendor/swift/lib/Demangling/Errors.cpp",
"vendor/swift/lib/Demangling/ManglingUtils.cpp",
"vendor/swift/lib/Demangling/NodeDumper.cpp",
"vendor/swift/lib/Demangling/NodePrinter.cpp",
// "vendor/swift/lib/Demangling/OldDemangler.cpp",
// "vendor/swift/lib/Demangling/OldRemangler.cpp",
"vendor/swift/lib/Demangling/Punycode.cpp",
"vendor/swift/lib/Demangling/Remangler.cpp",
])
Expand Down
8 changes: 7 additions & 1 deletion symbolic-demangle/tests/test_swift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ fn test_demangle_swift_no_args() {

// Swift 6.0.3
"$ss27withTaskCancellationHandler9operation8onCancel9isolationxxyYaKXE_yyYbXEScA_pSgYitYaKlFTwb" => "withTaskCancellationHandler<A>",
"$s11Supercharge2AXO7ElementPAAE8elements33_35EDDAA799FBB5B74D2F426690B0D99DLL3for2asSayqd__GSo28NSAccessibilityAttributeNamea_qd__mtSo7AXErrorVYKAcDRd__lFAC3AppC_AC6WindowCTgm5" => "specialized AX.Element.elements<A>",

// Swift 6.1.0
"$sTB" => "$sTB",

// Swift 6.3.1
"$s12SharedDomain7ServiceC06streamC0_4bodyACXDScSyxG_yxYaYbKYCcts8SendableRzlFZyycAA06StreamC0CYbcfu_yycfu0_Tm" => "implicit closure #2 in implicit closure #1 in static Service.streamService<A>",
"$s18OrderedCollections0A10DictionaryV20uniqueKeysWithValuesACyxq_Gqd___tcSTRd__x_q_t7ElementRtd__lufC6TaggedAHVy8SportsUI0J23ParticipantRowViewModelVSSG_ALs15LazyMapSequenceVySayALGAM_ALtGTt0g5Tf4g_n" => "specialized OrderedDictionary.init<A>",
});
}
53 changes: 21 additions & 32 deletions symbolic-demangle/vendor/swift/1-arguments.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
commit 80e772078494a73f2fbb5e385de2092e6057d913
commit 7dddbd0e4b5ba23e640c1a4d531dc148f6d18aca
Author: David Herberth <david.herberth@sentry.io>
Date: Thu Jan 9 10:54:28 2025 +0100
Date: Mon May 18 14:50:49 2026 +0200

apply patch
patch

diff --git a/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h b/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h
index f66dd7fd..940c3652 100644
index 7a1b6c4a..3df6b0b9 100644
--- a/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h
+++ b/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h
@@ -58,6 +58,7 @@ struct DemangleOptions {
@@ -62,6 +62,7 @@ struct DemangleOptions {
bool ShortenArchetype = false;
bool ShowPrivateDiscriminators = true;
bool ShowFunctionArgumentTypes = true;
+ bool ShowFunctionReturnType = true;
bool DisplayDebuggerGeneratedModule = true;
bool DisplayStdlibModule = true;
bool DisplayObjCModule = true;
@@ -90,6 +91,7 @@ struct DemangleOptions {
@@ -94,6 +95,7 @@ struct DemangleOptions {
Opt.ShortenArchetype = true;
Opt.ShowPrivateDiscriminators = false;
Opt.ShowFunctionArgumentTypes = false;
Expand All @@ -25,32 +25,21 @@ index f66dd7fd..940c3652 100644
return Opt;
};
diff --git a/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp b/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp
index 6c309bbf..5b251e8d 100644
index 66840b56..7430062a 100644
--- a/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp
+++ b/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp
@@ -955,10 +955,11 @@ private:
if (isSendable)
Printer << "@Sendable ";

- printFunctionParameters(LabelList, node->getChild(argIndex), depth,
- Options.ShowFunctionArgumentTypes);
+ if (Options.ShowFunctionArgumentTypes) {
+ printFunctionParameters(LabelList, node->getChild(argIndex), depth, true);
+ }

- if (!Options.ShowFunctionArgumentTypes)
+ if (!Options.ShowFunctionReturnType)
return;

if (isAsync)
diff --git a/symbolic-demangle/vendor/swift/lib/Demangling/Demangler.cpp b/symbolic-demangle/vendor/swift/lib/Demangling/Demangler.cpp
index 6c309bbf..5b251e8d 100644
--- a/symbolic-demangle/vendor/swift/lib/Demangling/Demangler.cpp
+++ b/symbolic-demangle/vendor/swift/lib/Demangling/Demangler.cpp
@@ -3423,7 +3423,6 @@ NodePointer Demangler::demangleSpecAttributes(Node::Kind SpecKind) {
@@ -945,10 +945,11 @@ void NodePrinter::printFunctionType(NodePointer LabelList, NodePointer node,
if (isSendable)
Printer << "@Sendable ";

int PassID = (int)nextChar() - '0';
if (PassID < 0 || PassID >= MAX_SPECIALIZATION_PASS) {
- assert(false && "unexpected pass id");
return nullptr;
}
- printFunctionParameters(LabelList, node->getChild(argIndex), depth,
- Options.ShowFunctionArgumentTypes);
+ if (Options.ShowFunctionArgumentTypes) {
+ printFunctionParameters(LabelList, node->getChild(argIndex), depth, true);
+ }

- if (!Options.ShowFunctionArgumentTypes)
+ if (!Options.ShowFunctionReturnType)
return;

if (isAsync)
12 changes: 6 additions & 6 deletions symbolic-demangle/vendor/swift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This folder contains a vendored subset of the [Swift Programming Language]. The Swift library is
reduced to the demangler only to reduce the size of this package.

The current version is **Swift 5.5.1**.
The current version is **Swift 6.3.1**.

## Sentry Modifications

Expand All @@ -21,15 +21,15 @@ patch is maintained in `1-arguments.patch`.
```
$ git clone https://github.com/apple/swift.git
```
3. Check out dependencies:
```
$ ./swift/utils/update-checkout --clone
```
4. Check out the release branch of the latest release:
3. Check out the release branch of the latest release:
```
$ cd swift
$ git checkout swift-5.5.1-RELEASE
```
4. Check out dependencies:
```
$ ./utils/update-checkout --clone
```
5. Build the complete swift project (be very patient, this may take long):
```
$ ./utils/build-script --skip-build
Expand Down
23 changes: 23 additions & 0 deletions symbolic-demangle/vendor/swift/include/llvm/ADT/DenseMapInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <tuple>
#include <type_traits>
#include <utility>
Expand Down Expand Up @@ -320,6 +321,28 @@ struct DenseMapInfo<Enum, std::enable_if_t<std::is_enum_v<Enum>>> {

static bool isEqual(const Enum &LHS, const Enum &RHS) { return LHS == RHS; }
};

template <typename T> struct DenseMapInfo<std::optional<T>> {
using Optional = std::optional<T>;
using Info = DenseMapInfo<T>;

static inline Optional getEmptyKey() { return {Info::getEmptyKey()}; }

static inline Optional getTombstoneKey() { return {Info::getTombstoneKey()}; }

static unsigned getHashValue(const Optional &OptionalVal) {
return detail::combineHashValue(
OptionalVal.has_value(),
Info::getHashValue(OptionalVal.value_or(Info::getEmptyKey())));
}

static bool isEqual(const Optional &LHS, const Optional &RHS) {
if (LHS && RHS) {
return Info::isEqual(LHS.value(), RHS.value());
}
return !LHS && !RHS;
}
};
} // end namespace llvm

#endif // LLVM_ADT_DENSEMAPINFO_H
17 changes: 11 additions & 6 deletions symbolic-demangle/vendor/swift/include/llvm/ADT/Hashing.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#ifndef LLVM_ADT_HASHING_H
#define LLVM_ADT_HASHING_H

#include "llvm/ADT/ADL.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SwapByteOrder.h"
Expand Down Expand Up @@ -151,15 +152,15 @@ namespace detail {

inline uint64_t fetch64(const char *p) {
uint64_t result;
memcpy(&result, p, sizeof(result));
std::memcpy(&result, p, sizeof(result));
if (sys::IsBigEndianHost)
sys::swapByteOrder(result);
return result;
}

inline uint32_t fetch32(const char *p) {
uint32_t result;
memcpy(&result, p, sizeof(result));
std::memcpy(&result, p, sizeof(result));
if (sys::IsBigEndianHost)
sys::swapByteOrder(result);
return result;
Expand Down Expand Up @@ -328,7 +329,7 @@ struct hash_state {
/// This variable can be set using the \see llvm::set_fixed_execution_seed
/// function. See that function for details. Do not, under any circumstances,
/// set or read this variable.
extern uint64_t fixed_seed_override;
LLVM_ABI extern uint64_t fixed_seed_override;

inline uint64_t get_execution_seed() {
// FIXME: This needs to be a per-execution seed. This is just a placeholder
Expand Down Expand Up @@ -401,7 +402,7 @@ bool store_and_advance(char *&buffer_ptr, char *buffer_end, const T& value,
if (buffer_ptr + store_size > buffer_end)
return false;
const char *value_data = reinterpret_cast<const char *>(&value);
memcpy(buffer_ptr, value_data + offset, store_size);
std::memcpy(buffer_ptr, value_data + offset, store_size);
buffer_ptr += store_size;
return true;
}
Expand Down Expand Up @@ -492,6 +493,10 @@ hash_code hash_combine_range(InputIteratorT first, InputIteratorT last) {
return ::llvm::hashing::detail::hash_combine_range_impl(first, last);
}

// A wrapper for hash_combine_range above.
template <typename RangeT> hash_code hash_combine_range(RangeT &&R) {
return hash_combine_range(adl_begin(R), adl_end(R));
}

// Implementation details for hash_combine.
namespace hashing {
Expand Down Expand Up @@ -531,7 +536,7 @@ struct hash_combine_recursive_helper {
// with the variadic combine because that formation can have varying
// argument types.
size_t partial_store_size = buffer_end - buffer_ptr;
memcpy(buffer_ptr, &data, partial_store_size);
std::memcpy(buffer_ptr, &data, partial_store_size);

// If the store fails, our buffer is full and ready to hash. We have to
// either initialize the hash state (on the first full buffer) or mix
Expand Down Expand Up @@ -667,7 +672,7 @@ template <typename... Ts> hash_code hash_value(const std::tuple<Ts...> &arg) {
// infrastructure is available.
template <typename T>
hash_code hash_value(const std::basic_string<T> &arg) {
return hash_combine_range(arg.begin(), arg.end());
return hash_combine_range(arg);
}

template <typename T> hash_code hash_value(const std::optional<T> &arg) {
Expand Down
Loading
Loading