Skip to content

Commit

Permalink
[libcxxabi]: Resync llvm & libcxxabi's demangler
Browse files Browse the repository at this point in the history
Sadly the demangler copies have diverged.  This resyncs them by
a) pulling the meaningful llvm changes into libcxxabi's gold copy.
b) rerunning the sync script.

I notice uses of placement new, which assume the allocator succeeds --
that's incorrect in general, but an orthogonal problem.

Reviewed By: bader

Differential Revision: https://reviews.llvm.org/D135446
  • Loading branch information
urnathan committed Oct 12, 2022
1 parent f59e1bc commit 702d937
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
12 changes: 12 additions & 0 deletions libcxxabi/src/demangle/ItaniumDemangle.h
Expand Up @@ -370,6 +370,10 @@ class VendorExtQualType final : public Node {
VendorExtQualType(const Node *Ty_, StringView Ext_, const Node *TA_)
: Node(KVendorExtQualType), Ty(Ty_), Ext(Ext_), TA(TA_) {}

const Node *getTy() const { return Ty; }
StringView getExt() const { return Ext; }
const Node *getTA() const { return TA; }

template <typename Fn> void match(Fn F) const { F(Ty, Ext, TA); }

void printLeft(OutputBuffer &OB) const override {
Expand Down Expand Up @@ -418,6 +422,9 @@ class QualType final : public Node {
Child_->ArrayCache, Child_->FunctionCache),
Quals(Quals_), Child(Child_) {}

Qualifiers getQuals() const { return Quals; }
const Node *getChild() const { return Child; }

template<typename Fn> void match(Fn F) const { F(Child, Quals); }

bool hasRHSComponentSlow(OutputBuffer &OB) const override {
Expand Down Expand Up @@ -586,6 +593,8 @@ class PointerType final : public Node {
: Node(KPointerType, Pointee_->RHSComponentCache),
Pointee(Pointee_) {}

const Node *getPointee() const { return Pointee; }

template<typename Fn> void match(Fn F) const { F(Pointee); }

bool hasRHSComponentSlow(OutputBuffer &OB) const override {
Expand Down Expand Up @@ -1071,6 +1080,9 @@ class VectorType final : public Node {
VectorType(const Node *BaseType_, const Node *Dimension_)
: Node(KVectorType), BaseType(BaseType_), Dimension(Dimension_) {}

const Node *getBaseType() const { return BaseType; }
const Node *getDimension() const { return Dimension; }

template<typename Fn> void match(Fn F) const { F(BaseType, Dimension); }

void printLeft(OutputBuffer &OB) const override {
Expand Down
7 changes: 4 additions & 3 deletions llvm/include/llvm/Demangle/ItaniumDemangle.h
Expand Up @@ -13,8 +13,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_DEMANGLE_ITANIUMDEMANGLE_H
#define LLVM_DEMANGLE_ITANIUMDEMANGLE_H
#ifndef DEMANGLE_ITANIUMDEMANGLE_H
#define DEMANGLE_ITANIUMDEMANGLE_H

#include "DemangleConfig.h"
#include "StringView.h"
Expand All @@ -26,6 +26,7 @@
#include <cstdlib>
#include <cstring>
#include <limits>
#include <new>
#include <utility>

DEMANGLE_NAMESPACE_BEGIN
Expand Down Expand Up @@ -5489,4 +5490,4 @@ struct ManglingParser : AbstractManglingParser<ManglingParser<Alloc>, Alloc> {

DEMANGLE_NAMESPACE_END

#endif // LLVM_DEMANGLE_ITANIUMDEMANGLE_H
#endif // DEMANGLE_ITANIUMDEMANGLE_H
4 changes: 2 additions & 2 deletions llvm/include/llvm/Demangle/StringView.h
Expand Up @@ -13,8 +13,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_DEMANGLE_STRINGVIEW_H
#define LLVM_DEMANGLE_STRINGVIEW_H
#ifndef DEMANGLE_STRINGVIEW_H
#define DEMANGLE_STRINGVIEW_H

#include "DemangleConfig.h"
#include <cassert>
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/Demangle/Utility.h
Expand Up @@ -13,8 +13,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_DEMANGLE_UTILITY_H
#define LLVM_DEMANGLE_UTILITY_H
#ifndef DEMANGLE_UTILITY_H
#define DEMANGLE_UTILITY_H

#include "StringView.h"
#include <array>
Expand Down

0 comments on commit 702d937

Please sign in to comment.