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