class TypeVisitor

Declaration

template <typename ImplClass, typename RetTy = void>
class TypeVisitor { /* full declaration omitted */ };

Description

An operation on a type. 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 \c VisitFooType, if actual argument type is \c 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\c ImplClass provides specific action for some type, say\c ConstantArrayType, it should define method VisitConstantArrayType(const ConstantArrayType*) . Otherwise\c TypeVisitor dispatches call to the method that handles parent type. In this example handlers are tried in the sequence: The first function of this sequence that is defined will handle object of type \c ConstantArrayType.

Declared at: clang/include/clang/AST/TypeVisitor.h:64

Templates

ImplClass
Class implementing the operation. Must be inherited from TypeVisitor.
RetTy = void
%Type of result produced by the operation.

Method Overview

  • public RetTy Visit(const clang::Type * T)
  • public RetTy VisitType(const clang::Type *)

Methods

RetTy Visit(const clang::Type* T)

Description

Performs the operation associated with this visitor object.

Declared at: clang/include/clang/AST/TypeVisitor.h:68

Parameters

const clang::Type* T

RetTy VisitType(const clang::Type*)

Description

Method called if \c ImpClass doesn't provide specific handler for some type class.

Declared at: clang/include/clang/AST/TypeVisitor.h:87

Parameters

const clang::Type*