LLDB mainline
lldb_private::postfix::Visitor< ResultT > Class Template Referenceabstract

A template class implementing a visitor pattern, but with a couple of twists: More...

#include <PostfixExpression.h>

Protected Member Functions

virtual ~Visitor ()=default
virtual ResultT Visit (BinaryOpNode &binary, Node *&ref)=0
virtual ResultT Visit (InitialValueNode &val, Node *&ref)=0
virtual ResultT Visit (IntegerNode &integer, Node *&)=0
virtual ResultT Visit (RegisterNode &reg, Node *&)=0
virtual ResultT Visit (SymbolNode &symbol, Node *&ref)=0
virtual ResultT Visit (UnaryOpNode &unary, Node *&ref)=0
ResultT Dispatch (Node *&node)
 Invoke the correct Visit function based on the dynamic type of the given node.

Detailed Description

template<typename ResultT = void>
class lldb_private::postfix::Visitor< ResultT >

A template class implementing a visitor pattern, but with a couple of twists:

  • It uses type switch instead of virtual double dispatch. This allows the
  • The Visit functions get an extra Node *& parameter, which refers to the child pointer of the parent of the node we are currently visiting. This allows mutating algorithms, which replace the currently visited node with a different one.
  • The class is templatized on the return type of the Visit functions, which means it's possible to return values from them.

Definition at line 163 of file PostfixExpression.h.

Constructor & Destructor Documentation

◆ ~Visitor()

template<typename ResultT = void>
virtual lldb_private::postfix::Visitor< ResultT >::~Visitor ( )
protectedvirtualdefault

Member Function Documentation

◆ Dispatch()

template<typename ResultT = void>
ResultT lldb_private::postfix::Visitor< ResultT >::Dispatch ( Node *& node)
inlineprotected

◆ Visit() [1/6]

template<typename ResultT = void>
virtual ResultT lldb_private::postfix::Visitor< ResultT >::Visit ( BinaryOpNode & binary,
Node *& ref )
protectedpure virtual

Referenced by Dispatch().

◆ Visit() [2/6]

template<typename ResultT = void>
virtual ResultT lldb_private::postfix::Visitor< ResultT >::Visit ( InitialValueNode & val,
Node *& ref )
protectedpure virtual

◆ Visit() [3/6]

template<typename ResultT = void>
virtual ResultT lldb_private::postfix::Visitor< ResultT >::Visit ( IntegerNode & integer,
Node *&  )
protectedpure virtual

References integer.

◆ Visit() [4/6]

template<typename ResultT = void>
virtual ResultT lldb_private::postfix::Visitor< ResultT >::Visit ( RegisterNode & reg,
Node *&  )
protectedpure virtual

◆ Visit() [5/6]

template<typename ResultT = void>
virtual ResultT lldb_private::postfix::Visitor< ResultT >::Visit ( SymbolNode & symbol,
Node *& ref )
protectedpure virtual

◆ Visit() [6/6]

template<typename ResultT = void>
virtual ResultT lldb_private::postfix::Visitor< ResultT >::Visit ( UnaryOpNode & unary,
Node *& ref )
protectedpure virtual

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