Spicy
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
hilti::declaration::Field Class Reference

#include <field.h>

Inheritance diagram for hilti::declaration::Field:
hilti::Declaration hilti::Node hilti::node::WithDocString

Public Member Functions

auto attributes () const
 
auto inlineFunction () const
 
auto operator_ () const
 
QualifiedTypetype () const
 
bool isResolved (node::CycleDetector *cd=nullptr) const
 
hilti::Expressiondefault_ () const
 
auto isAnonymous () const
 
auto isInternal () const
 
auto isOptional () const
 
auto isStatic () const
 
auto isNoEmit () const
 
auto isNoEmitPrivate () const
 
auto isNoEmitOptimized () const
 
UnqualifiedTypelinkedType (ASTContext *ctx) const
 
auto linkedTypeIndex () const
 
void setAttributes (ASTContext *ctx, AttributeSet *attrs)
 
void setOperator (const Operator *op)
 
void setType (ASTContext *ctx, QualifiedType *t)
 
void setLinkedTypeIndex (ast::TypeIndex idx)
 
std::string_view displayName () const final
 
node::Properties properties () const final
 
- Public Member Functions inherited from hilti::Declaration
const auto & id () const
 
auto linkage () const
 
auto isPublic () const
 
const auto & fullyQualifiedID () const
 
const auto & canonicalID () const
 
auto declarationIndex () const
 
void setID (const ID &id)
 
void setLinkage (declaration::Linkage linkage)
 
void setFullyQualifiedID (ID id)
 
void setCanonicalID (ID id)
 
 Declaration (const Declaration &other)
 
 Declaration (Declaration &&other)=default
 
Declarationoperator= (const Declaration &other)=delete
 
Declarationoperator= (Declaration &&other)=delete
 
- Public Member Functions inherited from hilti::Node
node::Tag nodeTag () const
 
bool hasParent () const
 
Nodeparent (int i=1) const
 
template<typename T >
T * parent () const
 
template<typename... Args>
bool pathMatches () const
 
auto pathLength () const
 
const auto & meta () const
 
const auto & location () const
 
void setMeta (Meta m)
 
auto scope () const
 
auto getOrCreateScope ()
 
void clearScope ()
 
Result< std::pair< Declaration *, ID > > lookupID (const ID &id, const std::string_view &what) const
 
virtual bool inheritScope () const
 
std::string typename_ () const
 
uint64_t identity () const
 
const auto & children () const
 
template<typename T >
T * child (int i) const
 
template<typename T >
T * childTryAs (int i) const
 
Nodechild (int i) const
 
template<typename T >
auto children (int begin, std::optional< int > end) const
 
template<typename T >
auto children (int begin, std::optional< int > end)
 
template<typename T >
node::Set< T > childrenOfType () const
 
bool hasChild (const Node *n, bool recurse=false) const
 
Nodesibling (Node *n) const
 
void addChild (ASTContext *ctx, Node *n)
 
void addChildren (ASTContext *ctx, const Nodes &children)
 
void removeChild (Node *n)
 
void removeChildren (int begin, std::optional< int > end)
 
void setChild (ASTContext *ctx, size_t idx, Node *n)
 
NodeclearChild (int i)
 
void replaceChildren (ASTContext *ctx, const Nodes &children)
 
void replaceChild (ASTContext *ctx, Node *old, Node *new_)
 
NoderemoveFromParent ()
 
template<typename T >
bool isA () const
 
template<typename T >
bool isA_ () const
 
template<typename T >
T * as () const
 
template<typename T >
T * as ()
 
template<typename T >
const T * tryAs () const
 
template<typename T >
T * tryAs ()
 
template<typename T >
T * tryAs_ ()
 
void print (std::ostream &out, bool compact, bool user_visible) const
 
std::string print () const
 
std::string printRaw () const
 
 operator std::string () const
 
std::string dump () const
 
std::string renderSelf (bool include_location=true) const
 
void addError (std::string msg, std::vector< std::string > context={})
 
void addError (std::string msg, node::ErrorPriority priority, std::vector< std::string > context={})
 
void addError (std::string msg, const Location &, std::vector< std::string > context={})
 
void addError (std::string msg, Location l, node::ErrorPriority priority, std::vector< std::string > context={})
 
bool hasErrors () const
 
const auto & errors () const
 
void clearErrors ()
 
void clearChildren ()
 
void retain ()
 
void release ()
 
bool isRetained () const
 
virtual void dispatch (visitor::Dispatcher &v)=0
 
virtual std::string_view branchTag () const
 
Nodeoperator= (const Node &other)=delete
 
Nodeoperator= (Node &&other) noexcept=delete
 
- Public Member Functions inherited from hilti::node::WithDocString
const std::optional< DocString > & documentation () const
 
void clearDocumentation ()
 
void setDocumentation (DocString doc)
 

Static Public Member Functions

static auto create (ASTContext *ctx, ID id, QualifiedType *type, AttributeSet *attrs, Meta meta={})
 
static auto create (ASTContext *ctx, ID id, type::Function *ftype, AttributeSet *attrs, Meta meta={})
 
static auto create (ASTContext *ctx, ID id, hilti::Function *inline_func, AttributeSet *attrs, Meta meta={})
 

Protected Member Functions

 Field (ASTContext *ctx, Nodes children, ID id, Meta meta)
 
std::string _dump () const override
 
 HILTI_NODE_1 (declaration::Field, Declaration, final)
 
- Protected Member Functions inherited from hilti::Declaration
 Declaration (ASTContext *ctx, node::Tags node_tags, Nodes children, ID id, declaration::Linkage linkage, Meta meta={})
 
void setDeclarationIndex (ast::DeclarationIndex index)
 
 HILTI_NODE_0 (Declaration, override)
 
- Protected Member Functions inherited from hilti::Node
 Node (ASTContext *ctx, node::Tags node_tags, Nodes children, Meta meta)
 
 Node (ASTContext *, node::Tags node_tags, Meta meta)
 
 Node (Node &&other)=default
 
 Node (const Node &other)
 
virtual std::string _typename () const
 
virtual Node_clone (ASTContext *ctx) const =0
 

Additional Inherited Members

- Static Public Attributes inherited from hilti::Node
static constexpr uint16_t NodeLevel = 0
 
static constexpr ::hilti::node::Tag NodeTag = ::hilti::node::tag::Node
 
static constexpr ::hilti::node::Tags NodeTags = {::hilti::node::tag::Node}
 

Detailed Description

AST node for a struct/union field declaration.

Member Function Documentation

◆ _dump()

std::string declaration::Field::_dump ( ) const
overrideprotectedvirtual

Returns additional information to include into the node's dump() output, as provided by derived classes.

Reimplemented from hilti::Declaration.

◆ displayName()

std::string_view hilti::declaration::Field::displayName ( ) const
inlinefinalvirtual

Returns a user-friendly descriptive name for the type of object the declaration refers to (e.g., "local variable"). This can be used in messages to the user.

Implements hilti::Declaration.

◆ isNoEmitOptimized()

auto hilti::declaration::Field::isNoEmitOptimized ( ) const
inline

Returns true if the field has a &no-emit attribute with a string value of optimized.

◆ isNoEmitPrivate()

auto hilti::declaration::Field::isNoEmitPrivate ( ) const
inline

Returns true if the field has a &no-emit attribute with a string value of private.

◆ linkedType()

UnqualifiedType* hilti::declaration::Field::linkedType ( ASTContext ctx) const
inline

Returns the type that has been semantically linked to this field. The resolver sets the linked type to the field's parent type.

This is a short-cut to manually querying the context for the type with the index returned by linkedTypeIndex().

Parameters
ctxAST context to use for the lookup
Returns
linked type, or nullptr if none

◆ operator_()

auto hilti::declaration::Field::operator_ ( ) const
inline

Returns an operator corresponding to a call to the member function that the declaration corresponds to, if any.

◆ properties()

node::Properties declaration::Field::properties ( ) const
finalvirtual

Implements the node interface.

Reimplemented from hilti::Declaration.


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