Skip to content

Commit 5af7086

Browse files
authored
Make caches protected (#101184)
1 parent 442c33f commit 5af7086

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

libcxxabi/src/demangle/ItaniumDemangle.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@ class Node {
200200

201201
Prec Precedence : 6;
202202

203-
// FIXME: Make these protected.
204-
public:
203+
protected:
205204
/// Tracks if this node has a component on its right side, in which case we
206205
/// need to call printRight.
207206
Cache RHSComponentCache : 2;
@@ -255,6 +254,9 @@ class Node {
255254
Kind getKind() const { return K; }
256255

257256
Prec getPrecedence() const { return Precedence; }
257+
Cache getRHSComponentCache() const { return RHSComponentCache; }
258+
Cache getArrayCache() const { return ArrayCache; }
259+
Cache getFunctionCache() const { return FunctionCache; }
258260

259261
virtual bool hasRHSComponentSlow(OutputBuffer &) const { return false; }
260262
virtual bool hasArraySlow(OutputBuffer &) const { return false; }
@@ -424,8 +426,8 @@ class QualType final : public Node {
424426

425427
public:
426428
QualType(const Node *Child_, Qualifiers Quals_)
427-
: Node(KQualType, Child_->RHSComponentCache,
428-
Child_->ArrayCache, Child_->FunctionCache),
429+
: Node(KQualType, Child_->getRHSComponentCache(), Child_->getArrayCache(),
430+
Child_->getFunctionCache()),
429431
Quals(Quals_), Child(Child_) {}
430432

431433
Qualifiers getQuals() const { return Quals; }
@@ -554,8 +556,8 @@ struct AbiTagAttr : Node {
554556
std::string_view Tag;
555557

556558
AbiTagAttr(Node *Base_, std::string_view Tag_)
557-
: Node(KAbiTagAttr, Base_->RHSComponentCache, Base_->ArrayCache,
558-
Base_->FunctionCache),
559+
: Node(KAbiTagAttr, Base_->getRHSComponentCache(), Base_->getArrayCache(),
560+
Base_->getFunctionCache()),
559561
Base(Base_), Tag(Tag_) {}
560562

561563
template<typename Fn> void match(Fn F) const { F(Base, Tag); }
@@ -615,7 +617,7 @@ class PointerType final : public Node {
615617

616618
public:
617619
PointerType(const Node *Pointee_)
618-
: Node(KPointerType, Pointee_->RHSComponentCache),
620+
: Node(KPointerType, Pointee_->getRHSComponentCache()),
619621
Pointee(Pointee_) {}
620622

621623
const Node *getPointee() const { return Pointee; }
@@ -699,7 +701,7 @@ class ReferenceType : public Node {
699701

700702
public:
701703
ReferenceType(const Node *Pointee_, ReferenceKind RK_)
702-
: Node(KReferenceType, Pointee_->RHSComponentCache),
704+
: Node(KReferenceType, Pointee_->getRHSComponentCache()),
703705
Pointee(Pointee_), RK(RK_) {}
704706

705707
template<typename Fn> void match(Fn F) const { F(Pointee, RK); }
@@ -742,7 +744,7 @@ class PointerToMemberType final : public Node {
742744

743745
public:
744746
PointerToMemberType(const Node *ClassType_, const Node *MemberType_)
745-
: Node(KPointerToMemberType, MemberType_->RHSComponentCache),
747+
: Node(KPointerToMemberType, MemberType_->getRHSComponentCache()),
746748
ClassType(ClassType_), MemberType(MemberType_) {}
747749

748750
template<typename Fn> void match(Fn F) const { F(ClassType, MemberType); }
@@ -1383,16 +1385,14 @@ class ParameterPack final : public Node {
13831385
public:
13841386
ParameterPack(NodeArray Data_) : Node(KParameterPack), Data(Data_) {
13851387
ArrayCache = FunctionCache = RHSComponentCache = Cache::Unknown;
1386-
if (std::all_of(Data.begin(), Data.end(), [](Node* P) {
1387-
return P->ArrayCache == Cache::No;
1388-
}))
1388+
if (std::all_of(Data.begin(), Data.end(),
1389+
[](Node *P) { return P->getArrayCache() == Cache::No; }))
13891390
ArrayCache = Cache::No;
1390-
if (std::all_of(Data.begin(), Data.end(), [](Node* P) {
1391-
return P->FunctionCache == Cache::No;
1392-
}))
1391+
if (std::all_of(Data.begin(), Data.end(),
1392+
[](Node *P) { return P->getFunctionCache() == Cache::No; }))
13931393
FunctionCache = Cache::No;
1394-
if (std::all_of(Data.begin(), Data.end(), [](Node* P) {
1395-
return P->RHSComponentCache == Cache::No;
1394+
if (std::all_of(Data.begin(), Data.end(), [](Node *P) {
1395+
return P->getRHSComponentCache() == Cache::No;
13961396
}))
13971397
RHSComponentCache = Cache::No;
13981398
}

0 commit comments

Comments
 (0)