clang 20.0.0git
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clang::extractapi::APISetVisitor< Derived > Class Template Reference

The base interface of visitors for API information, the interface and usage is almost identical to RecurisveASTVistor. More...

#include "clang/ExtractAPI/Serialization/APISetVisitor.h"

Inheritance diagram for clang::extractapi::APISetVisitor< Derived >:
Inheritance graph
[legend]

Public Member Functions

bool traverseAPISet ()
 
bool traverseAPIRecord (const APIRecord *Record)
 
bool walkUpFromAPIRecord (const APIRecord *Record)
 
bool visitAPIRecord (const APIRecord *Record)
 
bool traverseRecordContext (const RecordContext *)
 
 APISetVisitor ()=delete
 
 APISetVisitor (const APISetVisitor &)=delete
 
 APISetVisitor (APISetVisitor &&)=delete
 
APISetVisitoroperator= (const APISetVisitor &)=delete
 
APISetVisitoroperator= (APISetVisitor &&)=delete
 

Protected Member Functions

 APISetVisitor (const APISet &API)
 
 ~APISetVisitor ()=default
 
Derived * getDerived ()
 

Protected Attributes

const APISetAPI
 

Detailed Description

template<typename Derived>
class clang::extractapi::APISetVisitor< Derived >

The base interface of visitors for API information, the interface and usage is almost identical to RecurisveASTVistor.

This class performs three distinct tasks:

  1. traverse the APISet (i.e. go to every record);
  2. at a given record, walk up the class hierarchy starting from the record's dynamic type until APIRecord is reached.
  3. given a (record, class) combination where 'class' is some base class of the dynamic type of 'record', call a user-overridable function to actually visit the record.

These tasks are done by three groups of methods, respectively:

  1. traverseRecord(APIRecord *x) does task #1, it is the entry point for traversing the records starting from x. This method simply forwards to traverseFoo(Foo *x) where Foo is the dynamic type of *x, which calls walkUpFromFoo(x) and then recursively visits the child records of x.
  2. walkUpFromFoo(Foo *x) does task #2. It doesn't visit children records of x, instead it first calls walkUpFromBar(x) where Bar is the direct parent class of Foo (unless Foo has no parent) and then calls visitFoo(x).
  3. visitFoo(Foo *x) does task #3.

These three method groups are tiered (traverse* > walkUpFrom* > visit*). A method (e.g. traverse*) may call methods from the same tier (e.g. other traverse*) or one tier lower (e.g. walkUpFrom*). It may not call methods from a higher tier.

Note that since walkUpFromFoo() calls walkUpFromBar() (where Bar is Foo's super class) before calling visitFoo(), the result is that the visit*() methods for a given record are called in the top-down order (e.g. for a record of type ObjCInstancePropertyRecord, the order will be visitRecord(), visitObjCPropertyRecord(), and then visitObjCInstancePropertyRecord()).

This scheme guarantees that all visit*() calls for the same record are grouped together. In other words, visit*() methods for different records are never interleaved.

Clients of this visitor should subclass the visitor (providing themselves as the template argument, using the curiously recurring template pattern) and override any of the traverse*, walkUpFrom*, and visit* methods for records where the visitor should customize behavior. Most users only need to override visit*. Advanced users may override traverse* and walkUpFrom* to implement custom traversal strategies. Returning false from one of these overridden functions will abort the entire traversal.

Definition at line 76 of file APISetVisitor.h.

Constructor & Destructor Documentation

◆ APISetVisitor() [1/4]

template<typename Derived >
clang::extractapi::APISetVisitor< Derived >::APISetVisitor ( )
delete

◆ APISetVisitor() [2/4]

template<typename Derived >
clang::extractapi::APISetVisitor< Derived >::APISetVisitor ( const APISetVisitor< Derived > &  )
delete

◆ APISetVisitor() [3/4]

template<typename Derived >
clang::extractapi::APISetVisitor< Derived >::APISetVisitor ( APISetVisitor< Derived > &&  )
delete

◆ APISetVisitor() [4/4]

template<typename Derived >
clang::extractapi::APISetVisitor< Derived >::APISetVisitor ( const APISet API)
inlineprotected

Definition at line 132 of file APISetVisitor.h.

◆ ~APISetVisitor()

template<typename Derived >
clang::extractapi::APISetVisitor< Derived >::~APISetVisitor ( )
protecteddefault

Member Function Documentation

◆ getDerived()

template<typename Derived >
Derived * clang::extractapi::APISetVisitor< Derived >::getDerived ( )
inlineprotected

Definition at line 135 of file APISetVisitor.h.

◆ operator=() [1/2]

template<typename Derived >
APISetVisitor & clang::extractapi::APISetVisitor< Derived >::operator= ( APISetVisitor< Derived > &&  )
delete

◆ operator=() [2/2]

template<typename Derived >
APISetVisitor & clang::extractapi::APISetVisitor< Derived >::operator= ( const APISetVisitor< Derived > &  )
delete

◆ traverseAPIRecord()

template<typename Derived >
bool clang::extractapi::APISetVisitor< Derived >::traverseAPIRecord ( const APIRecord Record)

◆ traverseAPISet()

template<typename Derived >
bool clang::extractapi::APISetVisitor< Derived >::traverseAPISet ( )
inline

◆ traverseRecordContext()

template<typename Derived >
bool clang::extractapi::APISetVisitor< Derived >::traverseRecordContext ( const RecordContext Context)

Definition at line 139 of file APISetVisitor.h.

References TRY_TO.

◆ visitAPIRecord()

template<typename Derived >
bool clang::extractapi::APISetVisitor< Derived >::visitAPIRecord ( const APIRecord Record)
inline

◆ walkUpFromAPIRecord()

template<typename Derived >
bool clang::extractapi::APISetVisitor< Derived >::walkUpFromAPIRecord ( const APIRecord Record)
inline

Member Data Documentation

◆ API

template<typename Derived >
const APISet& clang::extractapi::APISetVisitor< Derived >::API
protected

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