clang 20.0.0git
|
An operation on a type. More...
#include "clang/AST/TypeVisitor.h"
Public Member Functions | |
RetTy | Visit (const Type *T) |
Performs the operation associated with this visitor object. | |
RetTy | VisitType (const Type *) |
Method called if ImpClass doesn't provide specific handler for some type class. | |
An operation on a type.
ImplClass | Class implementing the operation. Must be inherited from TypeVisitor. |
RetTy | Type of result produced by the operation. |
The class implements polymorphic operation on an object of type derived from Type. The operation is performed by calling method Visit. It then dispatches the call to function VisitFooType
, if actual argument type is FooType
.
The class implements static polymorphism using Curiously Recurring Template Pattern. It is designed to be a base class for some concrete class:
Actual treatment is made by methods of the derived class, TypeVisitor only dispatches call to the appropriate method. If the implementation class ImplClass
provides specific action for some type, say ConstantArrayType
, it should define method VisitConstantArrayType(const ConstantArrayType*)
. Otherwise TypeVisitor
dispatches call to the method that handles parent type. In this example handlers are tried in the sequence:
ImplClass::VisitConstantArrayType(const ConstantArrayType*)
ImplClass::VisitArrayType(const ArrayType*)
ImplClass::VisitType(const Type*)
TypeVisitor::VisitType(const Type*)
The first function of this sequence that is defined will handle object of type ConstantArrayType
.
Definition at line 64 of file TypeVisitor.h.
|
inline |
Performs the operation associated with this visitor object.
Definition at line 68 of file TypeVisitor.h.
References clang::Type::getTypeClass(), and clang::T.
Referenced by clang::ASTImporter::Import(), clang::ASTImporter::ImportImpl(), clang::ASTNodeTraverser< Derived, NodeDelegateType >::Visit(), clang::TextNodeDumper::Visit(), and clang::TextNodeDumper::VisitTypeLoc().
|
inline |
Method called if ImpClass
doesn't provide specific handler for some type class.
Definition at line 87 of file TypeVisitor.h.