MLIR 22.0.0git
mlir::pdll::ast::DeclScope Class Reference

This class represents a scope for named AST decls. More...

#include "mlir/Tools/PDLL/AST/Nodes.h"

Public Member Functions

 DeclScope (DeclScope *parent=nullptr)
 Create a new scope with an optional parent scope.
DeclScopegetParentScope ()
 Return the parent scope of this scope, or nullptr if there is no parent.
const DeclScopegetParentScope () const
auto getDecls () const
 Return all of the decls within this scope.
void add (Decl *decl)
 Add a new decl to the scope.
Decllookup (StringRef name)
 Lookup a decl with the given name starting from this scope.
template<typename T>
T * lookup (StringRef name)
const Decllookup (StringRef name) const
template<typename T>
const T * lookup (StringRef name) const

Detailed Description

This class represents a scope for named AST decls.

A scope determines the visibility and lifetime of a named declaration.

Definition at line 64 of file Nodes.h.

Constructor & Destructor Documentation

◆ DeclScope()

mlir::pdll::ast::DeclScope::DeclScope ( DeclScope * parent = nullptr)
inline

Create a new scope with an optional parent scope.

Definition at line 67 of file Nodes.h.

References DeclScope().

Referenced by DeclScope(), getParentScope(), getParentScope(), and lookup().

Member Function Documentation

◆ add()

void DeclScope::add ( Decl * decl)

Add a new decl to the scope.

Definition at line 175 of file Nodes.cpp.

References mlir::pdll::ast::Decl::getName(), and mlir::pdll::ast::Name::getName().

◆ getDecls()

auto mlir::pdll::ast::DeclScope::getDecls ( ) const
inline

Return all of the decls within this scope.

Definition at line 74 of file Nodes.h.

◆ getParentScope() [1/2]

DeclScope * mlir::pdll::ast::DeclScope::getParentScope ( )
inline

Return the parent scope of this scope, or nullptr if there is no parent.

Definition at line 70 of file Nodes.h.

References DeclScope().

◆ getParentScope() [2/2]

const DeclScope * mlir::pdll::ast::DeclScope::getParentScope ( ) const
inline

Definition at line 71 of file Nodes.h.

References DeclScope().

◆ lookup() [1/4]

Decl * DeclScope::lookup ( StringRef name)

Lookup a decl with the given name starting from this scope.

Returns nullptr if no decl could be found.

Definition at line 182 of file Nodes.cpp.

Referenced by lookup(), and lookup().

◆ lookup() [2/4]

template<typename T>
T * mlir::pdll::ast::DeclScope::lookup ( StringRef name)
inline

Definition at line 83 of file Nodes.h.

References lookup().

◆ lookup() [3/4]

const Decl * mlir::pdll::ast::DeclScope::lookup ( StringRef name) const
inline

Definition at line 86 of file Nodes.h.

References DeclScope(), and lookup().

◆ lookup() [4/4]

template<typename T>
const T * mlir::pdll::ast::DeclScope::lookup ( StringRef name) const
inline

Definition at line 90 of file Nodes.h.

References lookup().


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