Skip to content

Commit

Permalink
feat(demangle): Import libswift demangle 6.0.3 (#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde authored Jan 9, 2025
1 parent 3f434d0 commit c18e618
Show file tree
Hide file tree
Showing 59 changed files with 8,451 additions and 11,157 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- Update libswift demangle to v6.0.3 ([#885](https://github.com/getsentry/symbolic/pull/885))

## 12.12.4

**Fixes**
Expand Down
11 changes: 8 additions & 3 deletions symbolic-demangle/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@ fn main() {
.cpp(true)
.files(&[
"src/swiftdemangle.cpp",
"vendor/swift/lib/Demangling/Demangler.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/OldDemangler.cpp",
// "vendor/swift/lib/Demangling/OldRemangler.cpp",
"vendor/swift/lib/Demangling/Punycode.cpp",
"vendor/swift/lib/Demangling/Remangler.cpp",
])
.flag_if_supported("-std=c++14")
.flag_if_supported("-std=c++17")
.flag_if_supported("-mmacosx-version-min=11.0.0")
.flag_if_supported("-Wno-changes-meaning")
.flag("-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1")
.flag("-DSWIFT_STDLIB_HAS_TYPE_PRINTING=1")
.warnings(false)
.include("vendor/swift/include")
.compile("swiftdemangle");
Expand Down
6 changes: 5 additions & 1 deletion symbolic-demangle/tests/test_swift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ fn test_demangle_swift_no_args() {
"$s7ranking22propertyVersusFunctionyyAA1P_p_xtAaCRzlFyAaC_pcAaC_pcfu_" => "implicit closure #1 in propertyVersusFunction<A>",

// Swift 5.5.1
"$s10Speediness17NetworkQualityCLIO3run10sequentialAC6ResultVSb_tYaKFZTf4nd_nTQ0_" => "(1) await resume partial function for specialized static NetworkQualityCLI.run",
"$s10Speediness17NetworkQualityCLIO3run10sequentialAC6ResultVSb_tYaKFZTf4nd_nTQ0_" => "specialized static NetworkQualityCLI.run",

// Swift 6.0.3
"$ss27withTaskCancellationHandler9operation8onCancel9isolationxxyYaKXE_yyYbXEScA_pSgYitYaKlFTwb" => "withTaskCancellationHandler<A>",
"$s11Supercharge2AXO7ElementPAAE8elements33_35EDDAA799FBB5B74D2F426690B0D99DLL3for2asSayqd__GSo28NSAccessibilityAttributeNamea_qd__mtSo7AXErrorVYKAcDRd__lFAC3AppC_AC6WindowCTgm5" => "specialized AX.Element.elements<A>",
});
}
22 changes: 11 additions & 11 deletions symbolic-demangle/vendor/swift/1-arguments.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
commit 43fca7dd2617ac93f338b5257a2e57c43dcb8154
Author: Sebastian Zivota <loewenheim@mailbox.org>
Date: Thu Dec 2 16:15:35 2021 +0100
commit 80e772078494a73f2fbb5e385de2092e6057d913
Author: David Herberth <david.herberth@sentry.io>
Date: Thu Jan 9 10:54:28 2025 +0100

Apply patch
apply patch

diff --git a/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h b/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h
index db32dbd..f48e1c2 100644
index f66dd7fd..940c3652 100644
--- a/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h
+++ b/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h
@@ -59,6 +59,7 @@ struct DemangleOptions {
@@ -58,6 +58,7 @@ struct DemangleOptions {
bool ShortenArchetype = false;
bool ShowPrivateDiscriminators = true;
bool ShowFunctionArgumentTypes = true;
Expand All @@ -21,21 +21,21 @@ index db32dbd..f48e1c2 100644
Opt.ShowPrivateDiscriminators = false;
Opt.ShowFunctionArgumentTypes = false;
+ Opt.ShowFunctionReturnType = false;
Opt.ShowAsyncResumePartial = false;
return Opt;
};
};
diff --git a/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp b/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp
index 2a9c0dc..34fa785 100644
index 6c309bbf..5b251e8d 100644
--- a/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp
+++ b/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp
@@ -863,10 +863,11 @@ private:
@@ -955,10 +955,11 @@ private:
if (isSendable)
Printer << "@Sendable ";

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

- if (!Options.ShowFunctionArgumentTypes)
Expand Down
135 changes: 135 additions & 0 deletions symbolic-demangle/vendor/swift/include/llvm/ADT/ADL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
//===- llvm/ADT/ADL.h - Argument dependent lookup utilities -----*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_ADT_ADL_H
#define LLVM_ADT_ADL_H

#include <type_traits>
#include <iterator>
#include <utility>

namespace llvm {

// Only used by compiler if both template types are the same. Useful when
// using SFINAE to test for the existence of member functions.
template <typename T, T> struct SameType;

namespace adl_detail {

using std::begin;

template <typename RangeT>
constexpr auto begin_impl(RangeT &&range)
-> decltype(begin(std::forward<RangeT>(range))) {
return begin(std::forward<RangeT>(range));
}

using std::end;

template <typename RangeT>
constexpr auto end_impl(RangeT &&range)
-> decltype(end(std::forward<RangeT>(range))) {
return end(std::forward<RangeT>(range));
}

using std::rbegin;

template <typename RangeT>
constexpr auto rbegin_impl(RangeT &&range)
-> decltype(rbegin(std::forward<RangeT>(range))) {
return rbegin(std::forward<RangeT>(range));
}

using std::rend;

template <typename RangeT>
constexpr auto rend_impl(RangeT &&range)
-> decltype(rend(std::forward<RangeT>(range))) {
return rend(std::forward<RangeT>(range));
}

using std::swap;

template <typename T>
constexpr void swap_impl(T &&lhs,
T &&rhs) noexcept(noexcept(swap(std::declval<T>(),
std::declval<T>()))) {
swap(std::forward<T>(lhs), std::forward<T>(rhs));
}

using std::size;

template <typename RangeT>
constexpr auto size_impl(RangeT &&range)
-> decltype(size(std::forward<RangeT>(range))) {
return size(std::forward<RangeT>(range));
}

} // end namespace adl_detail

/// Returns the begin iterator to \p range using `std::begin` and
/// function found through Argument-Dependent Lookup (ADL).
template <typename RangeT>
constexpr auto adl_begin(RangeT &&range)
-> decltype(adl_detail::begin_impl(std::forward<RangeT>(range))) {
return adl_detail::begin_impl(std::forward<RangeT>(range));
}

/// Returns the end iterator to \p range using `std::end` and
/// functions found through Argument-Dependent Lookup (ADL).
template <typename RangeT>
constexpr auto adl_end(RangeT &&range)
-> decltype(adl_detail::end_impl(std::forward<RangeT>(range))) {
return adl_detail::end_impl(std::forward<RangeT>(range));
}

/// Returns the reverse-begin iterator to \p range using `std::rbegin` and
/// function found through Argument-Dependent Lookup (ADL).
template <typename RangeT>
constexpr auto adl_rbegin(RangeT &&range)
-> decltype(adl_detail::rbegin_impl(std::forward<RangeT>(range))) {
return adl_detail::rbegin_impl(std::forward<RangeT>(range));
}

/// Returns the reverse-end iterator to \p range using `std::rend` and
/// functions found through Argument-Dependent Lookup (ADL).
template <typename RangeT>
constexpr auto adl_rend(RangeT &&range)
-> decltype(adl_detail::rend_impl(std::forward<RangeT>(range))) {
return adl_detail::rend_impl(std::forward<RangeT>(range));
}

/// Swaps \p lhs with \p rhs using `std::swap` and functions found through
/// Argument-Dependent Lookup (ADL).
template <typename T>
constexpr void adl_swap(T &&lhs, T &&rhs) noexcept(
noexcept(adl_detail::swap_impl(std::declval<T>(), std::declval<T>()))) {
adl_detail::swap_impl(std::forward<T>(lhs), std::forward<T>(rhs));
}

/// Returns the size of \p range using `std::size` and functions found through
/// Argument-Dependent Lookup (ADL).
template <typename RangeT>
constexpr auto adl_size(RangeT &&range)
-> decltype(adl_detail::size_impl(std::forward<RangeT>(range))) {
return adl_detail::size_impl(std::forward<RangeT>(range));
}

namespace detail {

template <typename RangeT>
using IterOfRange = decltype(adl_begin(std::declval<RangeT &>()));

template <typename RangeT>
using ValueOfRange =
std::remove_reference_t<decltype(*adl_begin(std::declval<RangeT &>()))>;

} // namespace detail
} // namespace llvm

#endif // LLVM_ADT_ADL_H
Loading

0 comments on commit c18e618

Please sign in to comment.