Skip to content

Commit

Permalink
Sync bela
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharlie committed Feb 3, 2024
1 parent 8616c0e commit 16da7ee
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion vendor/bela.lock
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/fcharlie/bela/tree/290e8f60a43031ca948e11d618606e8651b87be8
https://github.com/fcharlie/bela/tree/bec4b4ae18a7158c2060d1f0d73f042579f30b4e
2 changes: 1 addition & 1 deletion vendor/bela/include/bela/__phmap/VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
https://github.com/greg7mdp/parallel-hashmap.git
946ebad67a21212d11a0dd4deb7cdedc297d47bc
65775fa09fecaa65d0b0022ab6bf091c0e509445
2 changes: 1 addition & 1 deletion vendor/bela/include/bela/__phmap/phmap_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#define PHMAP_VERSION_MAJOR 1
#define PHMAP_VERSION_MINOR 3
#define PHMAP_VERSION_PATCH 11
#define PHMAP_VERSION_PATCH 12

// Included for the __GLIBC__ macro (or similar macros on other systems).
#include <limits.h>
Expand Down
2 changes: 1 addition & 1 deletion vendor/bela/src/belaund/llvm/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
llvm-project:946ebad67a21212d11a0dd4deb7cdedc297d47bc
llvm-project:e7ec0c972e6f5ddd01099fd05ca24352cb992b44
5 changes: 3 additions & 2 deletions vendor/bela/src/belaund/llvm/include/llvm/Demangle/Demangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum : int {
/// Returns a non-NULL pointer to a NUL-terminated C style string
/// that should be explicitly freed, if successful. Otherwise, may return
/// nullptr if mangled_name is not a valid mangling or is nullptr.
char *itaniumDemangle(std::string_view mangled_name);
char *itaniumDemangle(std::string_view mangled_name, bool ParseParams = true);

enum MSDemangleFlags {
MSDF_None = 0,
Expand Down Expand Up @@ -68,7 +68,8 @@ char *dlangDemangle(std::string_view MangledName);
std::string demangle(std::string_view MangledName);

bool nonMicrosoftDemangle(std::string_view MangledName, std::string &Result,
bool CanHaveLeadingDot = true);
bool CanHaveLeadingDot = true,
bool ParseParams = true);

/// "Partial" demangler. This supports demangling a string into an AST
/// (typically an intermediate stage in itaniumDemangle) and querying certain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@
DEMANGLE_NAMESPACE_BEGIN

template <class T, size_t N> class PODSmallVector {
static_assert(std::is_pod<T>::value,
"T is required to be a plain old data type");

static_assert(std::is_trivial<T>::value,
"T is required to be a trivial type");
T *First = nullptr;
T *Last = nullptr;
T *Cap = nullptr;
T Inline[N] = {0};
T Inline[N] = {};

bool isInline() const { return First == Inline; }

Expand Down Expand Up @@ -2793,7 +2792,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
Node *parseClassEnumType();
Node *parseQualifiedType();

Node *parseEncoding();
Node *parseEncoding(bool ParseParams = true);
bool parseCallOffset();
Node *parseSpecialName();

Expand Down Expand Up @@ -2910,7 +2909,7 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
Node *parseDestructorName();

/// Top-level entry point into the parser.
Node *parse();
Node *parse(bool ParseParams = true);
};

const char* parse_discriminator(const char* first, const char* last);
Expand Down Expand Up @@ -5404,7 +5403,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseSpecialName() {
// ::= <data name>
// ::= <special-name>
template <typename Derived, typename Alloc>
Node *AbstractManglingParser<Derived, Alloc>::parseEncoding() {
Node *AbstractManglingParser<Derived, Alloc>::parseEncoding(bool ParseParams) {
// The template parameters of an encoding are unrelated to those of the
// enclosing context.
SaveTemplateParams SaveTemplateParamsScope(this);
Expand All @@ -5430,6 +5429,16 @@ Node *AbstractManglingParser<Derived, Alloc>::parseEncoding() {
if (IsEndOfEncoding())
return Name;

// ParseParams may be false at the top level only, when called from parse().
// For example in the mangled name _Z3fooILZ3BarEET_f, ParseParams may be
// false when demangling 3fooILZ3BarEET_f but is always true when demangling
// 3Bar.
if (!ParseParams) {
while (consume())
;
return Name;
}

Node *Attrs = nullptr;
if (consumeIf("Ua9enable_ifI")) {
size_t BeforeArgs = Names.size();
Expand Down Expand Up @@ -5894,9 +5903,9 @@ AbstractManglingParser<Derived, Alloc>::parseTemplateArgs(bool TagTemplates) {
// extension ::= ___Z <encoding> _block_invoke<decimal-digit>+
// extension ::= ___Z <encoding> _block_invoke_<decimal-digit>+
template <typename Derived, typename Alloc>
Node *AbstractManglingParser<Derived, Alloc>::parse() {
Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {
if (consumeIf("_Z") || consumeIf("__Z")) {
Node *Encoding = getDerived().parseEncoding();
Node *Encoding = getDerived().parseEncoding(ParseParams);
if (Encoding == nullptr)
return nullptr;
if (look() == '.') {
Expand All @@ -5910,7 +5919,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parse() {
}

if (consumeIf("___Z") || consumeIf("____Z")) {
Node *Encoding = getDerived().parseEncoding();
Node *Encoding = getDerived().parseEncoding(ParseParams);
if (Encoding == nullptr || !consumeIf("_block_invoke"))
return nullptr;
bool RequireNumber = consumeIf('_');
Expand Down
5 changes: 3 additions & 2 deletions vendor/bela/src/belaund/llvm/lib/Demangle/Demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ static bool isRustEncoding(std::string_view S) { return starts_with(S, "_R"); }
static bool isDLangEncoding(std::string_view S) { return starts_with(S, "_D"); }

bool llvm::nonMicrosoftDemangle(std::string_view MangledName,
std::string &Result, bool CanHaveLeadingDot) {
std::string &Result, bool CanHaveLeadingDot,
bool ParseParams) {
char *Demangled = nullptr;

// Do not consider the dot prefix as part of the demangled symbol name.
Expand All @@ -57,7 +58,7 @@ bool llvm::nonMicrosoftDemangle(std::string_view MangledName,
}

if (isItaniumEncoding(MangledName))
Demangled = itaniumDemangle(MangledName);
Demangled = itaniumDemangle(MangledName, ParseParams);
else if (isRustEncoding(MangledName))
Demangled = rustDemangle(MangledName);
else if (isDLangEncoding(MangledName))
Expand Down
4 changes: 2 additions & 2 deletions vendor/bela/src/belaund/llvm/lib/Demangle/ItaniumDemangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@ class DefaultAllocator {

using Demangler = itanium_demangle::ManglingParser<DefaultAllocator>;

char *llvm::itaniumDemangle(std::string_view MangledName) {
char *llvm::itaniumDemangle(std::string_view MangledName, bool ParseParams) {
if (MangledName.empty())
return nullptr;

Demangler Parser(MangledName.data(),
MangledName.data() + MangledName.length());
Node *AST = Parser.parse();
Node *AST = Parser.parse(ParseParams);
if (!AST)
return nullptr;

Expand Down

0 comments on commit 16da7ee

Please sign in to comment.