clang 23.0.0git
clang::threadSafety::til::Variable Class Reference

A named variable, e.g. More...

#include "clang/Analysis/Analyses/ThreadSafetyTIL.h"

Inheritance diagram for clang::threadSafety::til::Variable:
[legend]

Public Types

enum  VariableKind { VK_Let , VK_Fun , VK_SFun }

Public Member Functions

 Variable (StringRef s, SExpr *D=nullptr)
 Variable (SExpr *D, const ValueDecl *Cvd=nullptr)
 Variable (const Variable &Vd, SExpr *D)
VariableKind kind () const
 Return the kind of variable (let, function param, or self)
StringRef name () const
 Return the name of the variable, if any.
const ValueDeclclangDecl () const
 Return the clang declaration for this variable, if any.
SExprdefinition ()
 Return the definition of the variable.
const SExprdefinition () const
void setName (StringRef S)
void setKind (VariableKind K)
void setDefinition (SExpr *E)
void setClangDecl (const ValueDecl *VD)
template<class V>
V::R_SExpr traverse (V &Vs, typename V::R_Ctx Ctx)
template<class C>
C::CType compare (const Variable *E, C &Cmp) const
Public Member Functions inherited from clang::threadSafety::til::SExpr
 SExpr ()=delete
TIL_Opcode opcode () const
void * operator new (size_t S, MemRegionRef &R)
void * operator new (size_t)=delete
 SExpr objects must be created in an arena.
void operator delete (void *)=delete
 SExpr objects cannot be deleted.
unsigned id () const
 Returns the instruction ID for this expression.
BasicBlockblock () const
 Returns the block, if this is an instruction in a basic block, otherwise returns null.
void setID (BasicBlock *B, unsigned id)
 Set the basic block and instruction ID for this expression.

Static Public Member Functions

static bool classof (const SExpr *E)

Friends

class BasicBlock
class Function
class Let
class SFunction

Additional Inherited Members

Protected Member Functions inherited from clang::threadSafety::til::SExpr
 SExpr (TIL_Opcode Op)
 SExpr (const SExpr &E)
SExproperator= (const SExpr &)=delete
Protected Attributes inherited from clang::threadSafety::til::SExpr
const TIL_Opcode Opcode
unsigned char Reserved = 0
unsigned short Flags = 0
unsigned SExprID = 0
BasicBlockBlock = nullptr

Detailed Description

A named variable, e.g.

"x".

There are two distinct places in which a Variable can appear in the AST. A variable declaration introduces a new variable, and can occur in 3 places: Let-expressions: (Let (x = t) u) Functions: (Function (x : t) u) Self-applicable functions (SFunction (x) t)

If a variable occurs in any other location, it is a reference to an existing variable declaration – e.g. 'x' in (x * y + z). To save space, we don't allocate a separate AST node for variable references; a reference is just a pointer to the original declaration.

Definition at line 281 of file ThreadSafetyTIL.h.

Member Enumeration Documentation

◆ VariableKind

Enumerator
VK_Let 

Let-variable.

VK_Fun 

Function parameter.

VK_SFun 

SFunction (self) parameter.

Definition at line 283 of file ThreadSafetyTIL.h.

Constructor & Destructor Documentation

◆ Variable() [1/3]

clang::threadSafety::til::Variable::Variable ( StringRef s,
SExpr * D = nullptr )
inline

◆ Variable() [2/3]

clang::threadSafety::til::Variable::Variable ( SExpr * D,
const ValueDecl * Cvd = nullptr )
inline

◆ Variable() [3/3]

clang::threadSafety::til::Variable::Variable ( const Variable & Vd,
SExpr * D )
inline

Member Function Documentation

◆ clangDecl()

const ValueDecl * clang::threadSafety::til::Variable::clangDecl ( ) const
inline

Return the clang declaration for this variable, if any.

Definition at line 319 of file ThreadSafetyTIL.h.

◆ classof()

bool clang::threadSafety::til::Variable::classof ( const SExpr * E)
inlinestatic

◆ compare()

template<class C>
C::CType clang::threadSafety::til::Variable::compare ( const Variable * E,
C & Cmp ) const
inline

Definition at line 339 of file ThreadSafetyTIL.h.

References clang::C, Cmp, and Variable().

◆ definition() [1/2]

SExpr * clang::threadSafety::til::Variable::definition ( )
inline

Return the definition of the variable.

For let-vars, this is the setting expression. For function and self parameters, it is the type of the variable.

Definition at line 324 of file ThreadSafetyTIL.h.

References clang::threadSafety::til::SExpr::SExpr().

Referenced by clang::threadSafety::til::Function::compare(), clang::threadSafety::til::Let::compare(), clang::threadSafety::til::PrettyPrinter< Self, StreamType >::printFunction(), and clang::threadSafety::til::PrettyPrinter< Self, StreamType >::printLet().

◆ definition() [2/2]

const SExpr * clang::threadSafety::til::Variable::definition ( ) const
inline

Definition at line 325 of file ThreadSafetyTIL.h.

References clang::threadSafety::til::SExpr::SExpr().

◆ kind()

VariableKind clang::threadSafety::til::Variable::kind ( ) const
inline

Return the kind of variable (let, function param, or self)

Definition at line 313 of file ThreadSafetyTIL.h.

References clang::threadSafety::til::SExpr::Flags.

Referenced by Variable().

◆ name()

StringRef clang::threadSafety::til::Variable::name ( ) const
inline

Return the name of the variable, if any.

Definition at line 316 of file ThreadSafetyTIL.h.

◆ setClangDecl()

void clang::threadSafety::til::Variable::setClangDecl ( const ValueDecl * VD)
inline

Definition at line 330 of file ThreadSafetyTIL.h.

◆ setDefinition()

void clang::threadSafety::til::Variable::setDefinition ( SExpr * E)
inline

Definition at line 329 of file ThreadSafetyTIL.h.

References clang::threadSafety::til::SExpr::SExpr().

◆ setKind()

◆ setName()

void clang::threadSafety::til::Variable::setName ( StringRef S)
inline

Definition at line 327 of file ThreadSafetyTIL.h.

◆ traverse()

template<class V>
V::R_SExpr clang::threadSafety::til::Variable::traverse ( V & Vs,
typename V::R_Ctx Ctx )
inline

◆ BasicBlock

friend class BasicBlock
friend

Definition at line 344 of file ThreadSafetyTIL.h.

References BasicBlock.

Referenced by BasicBlock.

◆ Function

friend class Function
friend

Definition at line 345 of file ThreadSafetyTIL.h.

References Function.

Referenced by Function.

◆ Let

friend class Let
friend

Definition at line 346 of file ThreadSafetyTIL.h.

References Let.

Referenced by Let.

◆ SFunction

friend class SFunction
friend

Definition at line 347 of file ThreadSafetyTIL.h.

References clang::threadSafety::til::SExpr::SExpr(), and SFunction.

Referenced by SFunction.


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