LLVM 20.0.0git
Public Types | Public Member Functions | Protected Attributes | List of all members
Node Class Referenceabstract

#include "llvm/Demangle/ItaniumDemangle.h"

Inherited by AbiTagAttr, ArraySubscriptExpr, ArrayType, BinaryExpr, BinaryFPType, BitIntType, BoolExpr, BracedExpr, BracedRangeExpr, CallExpr, CastExpr, ClosureTypeName, ConditionalExpr, ConstrainedTypeTemplateParamDecl, ConversionExpr, ConversionOperatorType, CtorDtorName, CtorVtableSpecialName, DeleteExpr, DotSuffix, DtorName, DynamicExceptionSpec, ElaboratedTypeSpefType, EnableIfAttr, EnclosingExpr, EnumLiteral, ExpandedSpecialSubstitution, ExplicitObjectParameter, ExprRequirement, FloatLiteralImpl< Float >, FoldExpr, ForwardTemplateReference, FunctionEncoding, FunctionParam, FunctionType, GlobalQualifiedName, InitListExpr, IntegerLiteral, LambdaExpr, LiteralOperator, LocalName, MemberExpr, MemberLikeFriendName, ModuleEntity, ModuleName, NameType, NameWithTemplateArgs, NestedName, NestedRequirement, NewExpr, NodeArrayNode, NoexceptSpec, NonTypeTemplateParamDecl, ObjCProtoName, ParameterPack, ParameterPackExpansion, PixelVectorType, PointerToMemberConversionExpr, PointerToMemberType, PointerType, PostfixExpr, PostfixQualifiedType, PrefixExpr, QualType, QualifiedName, ReferenceType, RequiresExpr, SizeofParamPackExpr, SpecialName, StringLiteral, StructuredBindingName, SubobjectExpr, SyntheticTemplateParamName, TemplateArgs, TemplateArgumentPack, TemplateParamPackDecl, TemplateParamQualifiedArg, TemplateTemplateParamDecl, ThrowExpr, TransformedType, TypeRequirement, TypeTemplateParamDecl, UnnamedTypeName, VectorType, and VendorExtQualType.

Public Types

enum  Kind : unsigned char
 
enum class  Cache : unsigned char { Yes , No , Unknown }
 Three-way bool to track a cached value. More...
 
enum class  Prec {
  Primary , Postfix , Unary , Cast ,
  PtrMem , Multiplicative , Additive , Shift ,
  Spaceship , Relational , Equality , And ,
  Xor , Ior , AndIf , OrIf ,
  Conditional , Assign , Comma , Default
}
 Operator precedence for expression nodes. More...
 

Public Member Functions

 Node (Kind K_, Prec Precedence_=Prec::Primary, Cache RHSComponentCache_=Cache::No, Cache ArrayCache_=Cache::No, Cache FunctionCache_=Cache::No)
 
 Node (Kind K_, Cache RHSComponentCache_, Cache ArrayCache_=Cache::No, Cache FunctionCache_=Cache::No)
 
template<typename Fn >
void visit (Fn F) const
 Visit the most-derived object corresponding to this object.
 
bool hasRHSComponent (OutputBuffer &OB) const
 
bool hasArray (OutputBuffer &OB) const
 
bool hasFunction (OutputBuffer &OB) const
 
Kind getKind () const
 
Prec getPrecedence () const
 
Cache getRHSComponentCache () const
 
Cache getArrayCache () const
 
Cache getFunctionCache () const
 
virtual bool hasRHSComponentSlow (OutputBuffer &) const
 
virtual bool hasArraySlow (OutputBuffer &) const
 
virtual bool hasFunctionSlow (OutputBuffer &) const
 
virtual const NodegetSyntaxNode (OutputBuffer &) const
 
void printAsOperand (OutputBuffer &OB, Prec P=Prec::Default, bool StrictlyWorse=false) const
 
void print (OutputBuffer &OB) const
 
virtual void printLeft (OutputBuffer &) const =0
 
virtual void printRight (OutputBuffer &) const
 
virtual bool printInitListAsType (OutputBuffer &, const NodeArray &) const
 
virtual std::string_view getBaseName () const
 
virtual ~Node ()=default
 
DEMANGLE_DUMP_METHOD void dump () const
 

Protected Attributes

Cache RHSComponentCache: 2
 Tracks if this node has a component on its right side, in which case we need to call printRight.
 
Cache ArrayCache: 2
 Track if this node is a (possibly qualified) array type.
 
Cache FunctionCache: 2
 Track if this node is a (possibly qualified) function type.
 

Detailed Description

Definition at line 163 of file ItaniumDemangle.h.

Member Enumeration Documentation

◆ Cache

enum class Node::Cache : unsigned char
strong

Three-way bool to track a cached value.

Unknown is possible if this node has an unexpanded parameter pack below it that may affect this cache.

Enumerator
Yes 
No 
Unknown 

Definition at line 172 of file ItaniumDemangle.h.

◆ Kind

Definition at line 165 of file ItaniumDemangle.h.

◆ Prec

enum class Node::Prec
strong

Operator precedence for expression nodes.

Used to determine required parens in expression emission.

Enumerator
Primary 
Postfix 
Unary 
Cast 
PtrMem 
Multiplicative 
Additive 
Shift 
Spaceship 
Relational 
Equality 
And 
Xor 
Ior 
AndIf 
OrIf 
Conditional 
Assign 
Comma 
Default 

Definition at line 176 of file ItaniumDemangle.h.

Constructor & Destructor Documentation

◆ Node() [1/2]

Node::Node ( Kind  K_,
Prec  Precedence_ = Prec::Primary,
Cache  RHSComponentCache_ = Cache::No,
Cache  ArrayCache_ = Cache::No,
Cache  FunctionCache_ = Cache::No 
)
inline

Definition at line 218 of file ItaniumDemangle.h.

◆ Node() [2/2]

Node::Node ( Kind  K_,
Cache  RHSComponentCache_,
Cache  ArrayCache_ = Cache::No,
Cache  FunctionCache_ = Cache::No 
)
inline

Definition at line 223 of file ItaniumDemangle.h.

◆ ~Node()

virtual Node::~Node ( )
virtualdefault

Member Function Documentation

◆ dump()

DEMANGLE_DUMP_METHOD void Node::dump ( ) const

◆ getArrayCache()

Cache Node::getArrayCache ( ) const
inline

Definition at line 259 of file ItaniumDemangle.h.

References ArrayCache.

◆ getBaseName()

virtual std::string_view Node::getBaseName ( ) const
inlinevirtual

◆ getFunctionCache()

Cache Node::getFunctionCache ( ) const
inline

Definition at line 260 of file ItaniumDemangle.h.

References FunctionCache.

◆ getKind()

Kind Node::getKind ( ) const
inline

◆ getPrecedence()

Prec Node::getPrecedence ( ) const
inline

◆ getRHSComponentCache()

Cache Node::getRHSComponentCache ( ) const
inline

Definition at line 258 of file ItaniumDemangle.h.

References RHSComponentCache.

◆ getSyntaxNode()

virtual const Node * Node::getSyntaxNode ( OutputBuffer ) const
inlinevirtual

Reimplemented in ParameterPack, and ForwardTemplateReference.

Definition at line 268 of file ItaniumDemangle.h.

Referenced by ForwardTemplateReference::getSyntaxNode().

◆ hasArray()

bool Node::hasArray ( OutputBuffer OB) const
inline

◆ hasArraySlow()

virtual bool Node::hasArraySlow ( OutputBuffer ) const
inlinevirtual

Reimplemented in ArrayType, QualType, ParameterPack, and ForwardTemplateReference.

Definition at line 263 of file ItaniumDemangle.h.

Referenced by hasArray().

◆ hasFunction()

bool Node::hasFunction ( OutputBuffer OB) const
inline

◆ hasFunctionSlow()

virtual bool Node::hasFunctionSlow ( OutputBuffer ) const
inlinevirtual

Reimplemented in FunctionType, FunctionEncoding, QualType, ParameterPack, and ForwardTemplateReference.

Definition at line 264 of file ItaniumDemangle.h.

Referenced by hasFunction().

◆ hasRHSComponent()

bool Node::hasRHSComponent ( OutputBuffer OB) const
inline

◆ hasRHSComponentSlow()

virtual bool Node::hasRHSComponentSlow ( OutputBuffer ) const
inlinevirtual

◆ print()

void Node::print ( OutputBuffer OB) const
inline

◆ printAsOperand()

void Node::printAsOperand ( OutputBuffer OB,
Prec  P = Prec::Default,
bool  StrictlyWorse = false 
) const
inline

◆ printInitListAsType()

virtual bool Node::printInitListAsType ( OutputBuffer ,
const NodeArray  
) const
inlinevirtual

Reimplemented in ArrayType.

Definition at line 301 of file ItaniumDemangle.h.

Referenced by InitListExpr::printLeft().

◆ printLeft()

virtual void Node::printLeft ( OutputBuffer ) const
pure virtual

Implemented in NodeArrayNode, DotSuffix, VendorExtQualType, QualType, ConversionOperatorType, PostfixQualifiedType, NameType, BitIntType, ElaboratedTypeSpefType, TransformedType, AbiTagAttr, EnableIfAttr, ObjCProtoName, PointerType, ReferenceType, PointerToMemberType, ArrayType, FunctionType, NoexceptSpec, DynamicExceptionSpec, ExplicitObjectParameter, FunctionEncoding, LiteralOperator, SpecialName, CtorVtableSpecialName, NestedName, MemberLikeFriendName, ModuleName, ModuleEntity, LocalName, QualifiedName, VectorType, PixelVectorType, BinaryFPType, SyntheticTemplateParamName, TemplateParamQualifiedArg, TypeTemplateParamDecl, ConstrainedTypeTemplateParamDecl, NonTypeTemplateParamDecl, TemplateTemplateParamDecl, TemplateParamPackDecl, ParameterPack, TemplateArgumentPack, ParameterPackExpansion, TemplateArgs, ForwardTemplateReference, NameWithTemplateArgs, GlobalQualifiedName, SpecialSubstitution, CtorDtorName, DtorName, UnnamedTypeName, ClosureTypeName, StructuredBindingName, BinaryExpr, ArraySubscriptExpr, PostfixExpr, ConditionalExpr, MemberExpr, SubobjectExpr, EnclosingExpr, CastExpr, SizeofParamPackExpr, CallExpr, NewExpr, DeleteExpr, PrefixExpr, FunctionParam, ConversionExpr, PointerToMemberConversionExpr, InitListExpr, BracedExpr, BracedRangeExpr, FoldExpr, ThrowExpr, BoolExpr, StringLiteral, LambdaExpr, EnumLiteral, IntegerLiteral, RequiresExpr, ExprRequirement, TypeRequirement, NestedRequirement, and FloatLiteralImpl< Float >.

Referenced by print(), QualType::printLeft(), AbiTagAttr::printLeft(), PointerToMemberType::printLeft(), ForwardTemplateReference::printLeft(), and CastExpr::printLeft().

◆ printRight()

virtual void Node::printRight ( OutputBuffer ) const
inlinevirtual

◆ visit()

template<typename Fn >
void Node::visit ( Fn  F) const

Visit the most-derived object corresponding to this object.

Visit the node.

Calls F(P), where P is the node cast to the appropriate derived class.

Definition at line 2621 of file ItaniumDemangle.h.

References DEMANGLE_ASSERT.

Member Data Documentation

◆ ArrayCache

Cache Node::ArrayCache
protected

Track if this node is a (possibly qualified) array type.

This can affect how we format the output string.

Definition at line 211 of file ItaniumDemangle.h.

Referenced by getArrayCache(), hasArray(), and ParameterPack::ParameterPack().

◆ FunctionCache

Cache Node::FunctionCache
protected

Track if this node is a (possibly qualified) function type.

This can affect how we format the output string.

Definition at line 215 of file ItaniumDemangle.h.

Referenced by getFunctionCache(), hasFunction(), and ParameterPack::ParameterPack().

◆ RHSComponentCache

Cache Node::RHSComponentCache
protected

Tracks if this node has a component on its right side, in which case we need to call printRight.

Definition at line 207 of file ItaniumDemangle.h.

Referenced by getRHSComponentCache(), hasRHSComponent(), ParameterPack::ParameterPack(), and print().


The documentation for this class was generated from the following file: