|
19 | 19 | #include "DemangleConfig.h"
|
20 | 20 | #include "StringViewExtras.h"
|
21 | 21 | #include "Utility.h"
|
| 22 | +#include <__cxxabi_config.h> |
22 | 23 | #include <algorithm>
|
23 | 24 | #include <cctype>
|
24 | 25 | #include <cstdio>
|
@@ -199,8 +200,7 @@ class Node {
|
199 | 200 |
|
200 | 201 | Prec Precedence : 6;
|
201 | 202 |
|
202 |
| - // FIXME: Make these protected. |
203 |
| -public: |
| 203 | +protected: |
204 | 204 | /// Tracks if this node has a component on its right side, in which case we
|
205 | 205 | /// need to call printRight.
|
206 | 206 | Cache RHSComponentCache : 2;
|
@@ -254,6 +254,9 @@ class Node {
|
254 | 254 | Kind getKind() const { return K; }
|
255 | 255 |
|
256 | 256 | Prec getPrecedence() const { return Precedence; }
|
| 257 | + Cache getRHSComponentCache() const { return RHSComponentCache; } |
| 258 | + Cache getArrayCache() const { return ArrayCache; } |
| 259 | + Cache getFunctionCache() const { return FunctionCache; } |
257 | 260 |
|
258 | 261 | virtual bool hasRHSComponentSlow(OutputBuffer &) const { return false; }
|
259 | 262 | virtual bool hasArraySlow(OutputBuffer &) const { return false; }
|
@@ -423,8 +426,8 @@ class QualType final : public Node {
|
423 | 426 |
|
424 | 427 | public:
|
425 | 428 | QualType(const Node *Child_, Qualifiers Quals_)
|
426 |
| - : Node(KQualType, Child_->RHSComponentCache, |
427 |
| - Child_->ArrayCache, Child_->FunctionCache), |
| 429 | + : Node(KQualType, Child_->getRHSComponentCache(), Child_->getArrayCache(), |
| 430 | + Child_->getFunctionCache()), |
428 | 431 | Quals(Quals_), Child(Child_) {}
|
429 | 432 |
|
430 | 433 | Qualifiers getQuals() const { return Quals; }
|
@@ -553,8 +556,8 @@ struct AbiTagAttr : Node {
|
553 | 556 | std::string_view Tag;
|
554 | 557 |
|
555 | 558 | AbiTagAttr(Node *Base_, std::string_view Tag_)
|
556 |
| - : Node(KAbiTagAttr, Base_->RHSComponentCache, Base_->ArrayCache, |
557 |
| - Base_->FunctionCache), |
| 559 | + : Node(KAbiTagAttr, Base_->getRHSComponentCache(), Base_->getArrayCache(), |
| 560 | + Base_->getFunctionCache()), |
558 | 561 | Base(Base_), Tag(Tag_) {}
|
559 | 562 |
|
560 | 563 | template<typename Fn> void match(Fn F) const { F(Base, Tag); }
|
@@ -614,7 +617,7 @@ class PointerType final : public Node {
|
614 | 617 |
|
615 | 618 | public:
|
616 | 619 | PointerType(const Node *Pointee_)
|
617 |
| - : Node(KPointerType, Pointee_->RHSComponentCache), |
| 620 | + : Node(KPointerType, Pointee_->getRHSComponentCache()), |
618 | 621 | Pointee(Pointee_) {}
|
619 | 622 |
|
620 | 623 | const Node *getPointee() const { return Pointee; }
|
@@ -698,7 +701,7 @@ class ReferenceType : public Node {
|
698 | 701 |
|
699 | 702 | public:
|
700 | 703 | ReferenceType(const Node *Pointee_, ReferenceKind RK_)
|
701 |
| - : Node(KReferenceType, Pointee_->RHSComponentCache), |
| 704 | + : Node(KReferenceType, Pointee_->getRHSComponentCache()), |
702 | 705 | Pointee(Pointee_), RK(RK_) {}
|
703 | 706 |
|
704 | 707 | template<typename Fn> void match(Fn F) const { F(Pointee, RK); }
|
@@ -741,7 +744,7 @@ class PointerToMemberType final : public Node {
|
741 | 744 |
|
742 | 745 | public:
|
743 | 746 | PointerToMemberType(const Node *ClassType_, const Node *MemberType_)
|
744 |
| - : Node(KPointerToMemberType, MemberType_->RHSComponentCache), |
| 747 | + : Node(KPointerToMemberType, MemberType_->getRHSComponentCache()), |
745 | 748 | ClassType(ClassType_), MemberType(MemberType_) {}
|
746 | 749 |
|
747 | 750 | template<typename Fn> void match(Fn F) const { F(ClassType, MemberType); }
|
@@ -1382,16 +1385,14 @@ class ParameterPack final : public Node {
|
1382 | 1385 | public:
|
1383 | 1386 | ParameterPack(NodeArray Data_) : Node(KParameterPack), Data(Data_) {
|
1384 | 1387 | ArrayCache = FunctionCache = RHSComponentCache = Cache::Unknown;
|
1385 |
| - if (std::all_of(Data.begin(), Data.end(), [](Node* P) { |
1386 |
| - return P->ArrayCache == Cache::No; |
1387 |
| - })) |
| 1388 | + if (std::all_of(Data.begin(), Data.end(), |
| 1389 | + [](Node *P) { return P->getArrayCache() == Cache::No; })) |
1388 | 1390 | ArrayCache = Cache::No;
|
1389 |
| - if (std::all_of(Data.begin(), Data.end(), [](Node* P) { |
1390 |
| - return P->FunctionCache == Cache::No; |
1391 |
| - })) |
| 1391 | + if (std::all_of(Data.begin(), Data.end(), |
| 1392 | + [](Node *P) { return P->getFunctionCache() == Cache::No; })) |
1392 | 1393 | FunctionCache = Cache::No;
|
1393 |
| - if (std::all_of(Data.begin(), Data.end(), [](Node* P) { |
1394 |
| - return P->RHSComponentCache == Cache::No; |
| 1394 | + if (std::all_of(Data.begin(), Data.end(), [](Node *P) { |
| 1395 | + return P->getRHSComponentCache() == Cache::No; |
1395 | 1396 | }))
|
1396 | 1397 | RHSComponentCache = Cache::No;
|
1397 | 1398 | }
|
|
0 commit comments