MLIR  19.0.0git
Public Member Functions | Protected Member Functions | Friends | List of all members
mlir::bufferization::OneShotAnalysisState::Extension Class Reference

Base class for OneShotAnalysisState extensions that allow OneShotAnalysisState to contain user-specified information in the state object. More...

#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"

+ Inheritance diagram for mlir::bufferization::OneShotAnalysisState::Extension:

Public Member Functions

virtual ~Extension ()
 Base virtual destructor. More...
 

Protected Member Functions

 Extension (OneShotAnalysisState &state)
 Constructs an extension of the given state object. More...
 
const OneShotAnalysisStategetAnalysisState () const
 Provides read-only access to the parent OneShotAnalysisState object. More...
 

Friends

class OneShotAnalysisState
 

Detailed Description

Base class for OneShotAnalysisState extensions that allow OneShotAnalysisState to contain user-specified information in the state object.

Clients are expected to derive this class, add the desired fields, and make the derived class compatible with the MLIR TypeID mechanism.

class MyExtension final : public OneShotAnalysisState::Extension {
public:
MyExtension(OneShotAnalysisState &state, int myData)
: Extension(state) {...}
private:
int mySupplementaryData;
};

Instances of this and derived classes are not expected to be created by the user, instead they are directly constructed within a OneShotAnalysisState. A OneShotAnalysisState can only contain one extension with the given TypeID. Extensions can be obtained from a OneShotAnalysisState instance.

state.addExtension<MyExtension>(/*myData=*&zwj;/42);
MyExtension *ext = state.getExtension<MyExtension>();
ext->doSomething();

Definition at line 169 of file OneShotAnalysis.h.

Constructor & Destructor Documentation

◆ ~Extension()

OneShotAnalysisState::Extension::~Extension ( )
virtualdefault

Base virtual destructor.

◆ Extension()

mlir::bufferization::OneShotAnalysisState::Extension::Extension ( OneShotAnalysisState state)
inlineprotected

Constructs an extension of the given state object.

Definition at line 181 of file OneShotAnalysis.h.

Member Function Documentation

◆ getAnalysisState()

const OneShotAnalysisState& mlir::bufferization::OneShotAnalysisState::Extension::getAnalysisState ( ) const
inlineprotected

Provides read-only access to the parent OneShotAnalysisState object.

Definition at line 184 of file OneShotAnalysis.h.

Friends And Related Function Documentation

◆ OneShotAnalysisState

Definition at line 171 of file OneShotAnalysis.h.


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