Skip to content

Commit

Permalink
fix(demangle): Suppresses c++ warnings on older GCCs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Jan 9, 2025
1 parent c142946 commit a53ed9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion symbolic-demangle/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() {
"vendor/swift/lib/Demangling/Remangler.cpp",
])
.flag_if_supported("-std=c++17")
.flag_if_supported("-mmacosx-version-min=11.0.0")
.flag_if_supported("-fpermissive")
.flag_if_supported("-Wno-changes-meaning")
.flag("-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1")
.flag("-DSWIFT_STDLIB_HAS_TYPE_PRINTING=1")
Expand Down
26 changes: 13 additions & 13 deletions symbolic-demangle/vendor/swift/include/swift/Demangling/Demangler.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Demangle {
SWIFT_BEGIN_INLINE_NAMESPACE

class CharVector;

/// The allocator for demangling nodes and other demangling-internal stuff.
///
/// It implements a simple bump-pointer allocator.
Expand All @@ -49,7 +49,7 @@ class NodeFactory {
Slab *Previous;
// Tail allocated memory starts here.
};

/// The head of the single-linked slab list.
Slab *CurrentSlab = nullptr;

Expand Down Expand Up @@ -131,9 +131,9 @@ class NodeFactory {
BorrowedFrom->isBorrowed = false;
}
}

virtual void clear();

/// Allocates an object of type T or an array of objects of type T.
template<typename T> T *Allocate(size_t NumObjects = 1) {
assert(!isBorrowed);
Expand Down Expand Up @@ -266,7 +266,7 @@ class NodeFactory {
/// The \p Text string is already allocated with the Factory and therefore
/// it is _not_ copied.
NodePointer createNode(Node::Kind K, const CharVector &Text);

/// Creates a node of kind \p K with a \p Text payload, which must be a C
/// string literal.
///
Expand Down Expand Up @@ -301,7 +301,7 @@ template<typename T> class Vector {
NumElems = 0;
Capacity = InitialCapacity;
}

void free() {
Capacity = 0;
Elems = 0;
Expand All @@ -313,7 +313,7 @@ template<typename T> class Vector {

iterator begin() { return Elems; }
iterator end() { return Elems + NumElems; }

T &operator[](size_t Idx) {
assert(Idx < NumElems);
return Elems[Idx];
Expand All @@ -323,7 +323,7 @@ template<typename T> class Vector {
assert(Idx < NumElems);
return Elems[Idx];
}

size_t size() const { return NumElems; }

bool empty() const { return NumElems == 0; }
Expand Down Expand Up @@ -411,7 +411,7 @@ class Demangler : public NodeFactory {
static const int MaxNumWords = 26;
StringRef Words[MaxNumWords];
int NumWords = 0;

std::function<SymbolicReferenceResolver_t> SymbolicReferenceResolver;

bool nextIf(StringRef str) {
Expand Down Expand Up @@ -476,7 +476,7 @@ class Demangler : public NodeFactory {
Node::Kind NdKind = NodeStack.back()->getKind();
if (!pred(NdKind))
return nullptr;

return popNode();
}

Expand All @@ -490,14 +490,14 @@ class Demangler : public NodeFactory {
StringRef Text;
size_t Pos;
std::function<SymbolicReferenceResolver_t> SymbolicReferenceResolver;

public:
DemangleInitRAII(Demangler &Dem, StringRef MangledName,
std::function<SymbolicReferenceResolver_t> SymbolicReferenceResolver);
~DemangleInitRAII();
};
friend DemangleInitRAII;

void addSubstitution(NodePointer Nd) {
if (Nd) {
Substitutions.push_back(Nd, *this);
Expand Down Expand Up @@ -641,7 +641,7 @@ class Demangler : public NodeFactory {

public:
Demangler() {}

void clear() override;

/// Demangle the given symbol and return the parse tree.
Expand Down

0 comments on commit a53ed9e

Please sign in to comment.