diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h index b3976d7fbf41f..fb2060fa07f72 100644 --- a/llvm/include/llvm/Demangle/ItaniumDemangle.h +++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -30,7 +30,7 @@ #include #include -#ifdef _LIBCXXABI_COMPILER_CLANG +#if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-template" #endif @@ -199,8 +199,7 @@ class Node { Prec Precedence : 6; - // FIXME: Make these protected. -public: +protected: /// Tracks if this node has a component on its right side, in which case we /// need to call printRight. Cache RHSComponentCache : 2; @@ -254,6 +253,9 @@ class Node { Kind getKind() const { return K; } Prec getPrecedence() const { return Precedence; } + Cache getRHSComponentCache() const { return RHSComponentCache; } + Cache getArrayCache() const { return ArrayCache; } + Cache getFunctionCache() const { return FunctionCache; } virtual bool hasRHSComponentSlow(OutputBuffer &) const { return false; } virtual bool hasArraySlow(OutputBuffer &) const { return false; } @@ -423,8 +425,8 @@ class QualType final : public Node { public: QualType(const Node *Child_, Qualifiers Quals_) - : Node(KQualType, Child_->RHSComponentCache, - Child_->ArrayCache, Child_->FunctionCache), + : Node(KQualType, Child_->getRHSComponentCache(), Child_->getArrayCache(), + Child_->getFunctionCache()), Quals(Quals_), Child(Child_) {} Qualifiers getQuals() const { return Quals; } @@ -553,8 +555,8 @@ struct AbiTagAttr : Node { std::string_view Tag; AbiTagAttr(Node *Base_, std::string_view Tag_) - : Node(KAbiTagAttr, Base_->RHSComponentCache, Base_->ArrayCache, - Base_->FunctionCache), + : Node(KAbiTagAttr, Base_->getRHSComponentCache(), Base_->getArrayCache(), + Base_->getFunctionCache()), Base(Base_), Tag(Tag_) {} template void match(Fn F) const { F(Base, Tag); } @@ -614,7 +616,7 @@ class PointerType final : public Node { public: PointerType(const Node *Pointee_) - : Node(KPointerType, Pointee_->RHSComponentCache), + : Node(KPointerType, Pointee_->getRHSComponentCache()), Pointee(Pointee_) {} const Node *getPointee() const { return Pointee; } @@ -698,7 +700,7 @@ class ReferenceType : public Node { public: ReferenceType(const Node *Pointee_, ReferenceKind RK_) - : Node(KReferenceType, Pointee_->RHSComponentCache), + : Node(KReferenceType, Pointee_->getRHSComponentCache()), Pointee(Pointee_), RK(RK_) {} template void match(Fn F) const { F(Pointee, RK); } @@ -741,7 +743,7 @@ class PointerToMemberType final : public Node { public: PointerToMemberType(const Node *ClassType_, const Node *MemberType_) - : Node(KPointerToMemberType, MemberType_->RHSComponentCache), + : Node(KPointerToMemberType, MemberType_->getRHSComponentCache()), ClassType(ClassType_), MemberType(MemberType_) {} template void match(Fn F) const { F(ClassType, MemberType); } @@ -1382,16 +1384,14 @@ class ParameterPack final : public Node { public: ParameterPack(NodeArray Data_) : Node(KParameterPack), Data(Data_) { ArrayCache = FunctionCache = RHSComponentCache = Cache::Unknown; - if (std::all_of(Data.begin(), Data.end(), [](Node* P) { - return P->ArrayCache == Cache::No; - })) + if (std::all_of(Data.begin(), Data.end(), + [](Node *P) { return P->getArrayCache() == Cache::No; })) ArrayCache = Cache::No; - if (std::all_of(Data.begin(), Data.end(), [](Node* P) { - return P->FunctionCache == Cache::No; - })) + if (std::all_of(Data.begin(), Data.end(), + [](Node *P) { return P->getFunctionCache() == Cache::No; })) FunctionCache = Cache::No; - if (std::all_of(Data.begin(), Data.end(), [](Node* P) { - return P->RHSComponentCache == Cache::No; + if (std::all_of(Data.begin(), Data.end(), [](Node *P) { + return P->getRHSComponentCache() == Cache::No; })) RHSComponentCache = Cache::No; } @@ -5947,7 +5947,7 @@ struct ManglingParser : AbstractManglingParser, Alloc> { DEMANGLE_NAMESPACE_END -#ifdef _LIBCXXABI_COMPILER_CLANG +#if defined(__clang__) #pragma clang diagnostic pop #endif