clang 20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
clang::FunctionEffect Class Reference

Represents an abstract function effect, using just an enumeration describing its kind. More...

#include "clang/AST/Type.h"

Public Types

enum class  Kind : uint8_t {
  NonBlocking , NonAllocating , Blocking , Allocating ,
  Last = Allocating
}
 Identifies the particular effect. More...
 
enum  FlagBit : Flags {
  FE_InferrableOnCallees = 0x1 , FE_ExcludeThrow = 0x2 , FE_ExcludeCatch = 0x4 , FE_ExcludeObjCMessageSend = 0x8 ,
  FE_ExcludeStaticLocalVars = 0x10 , FE_ExcludeThreadLocalVars = 0x20
}
 
using Flags = unsigned
 Flags describing some behaviors of the effect.
 

Public Member Functions

 FunctionEffect (Kind K)
 
Kind kind () const
 The kind of the effect.
 
Kind oppositeKind () const
 Return the opposite kind, for effects which have opposites.
 
uint32_t toOpaqueInt32 () const
 For serialization.
 
Flags flags () const
 Flags describing some behaviors of the effect.
 
StringRef name () const
 The description printed in diagnostics, e.g. 'nonblocking'.
 
std::optional< FunctionEffecteffectProhibitingInference (const Decl &Callee, FunctionEffectKindSet CalleeFX) const
 Determine whether the effect is allowed to be inferred on the callee, which is either a FunctionDecl or BlockDecl.
 
bool shouldDiagnoseFunctionCall (bool Direct, FunctionEffectKindSet CalleeFX) const
 

Static Public Member Functions

static FunctionEffect fromOpaqueInt32 (uint32_t Value)
 

Static Public Attributes

static constexpr size_t KindCount = static_cast<size_t>(Kind::Last) + 1
 

Friends

raw_ostream & operator<< (raw_ostream &OS, const FunctionEffect &Effect)
 
bool operator== (FunctionEffect LHS, FunctionEffect RHS)
 
bool operator!= (FunctionEffect LHS, FunctionEffect RHS)
 
bool operator< (FunctionEffect LHS, FunctionEffect RHS)
 

Detailed Description

Represents an abstract function effect, using just an enumeration describing its kind.

Definition at line 4716 of file Type.h.

Member Typedef Documentation

◆ Flags

Flags describing some behaviors of the effect.

Definition at line 4729 of file Type.h.

Member Enumeration Documentation

◆ FlagBit

Enumerator
FE_InferrableOnCallees 
FE_ExcludeThrow 
FE_ExcludeCatch 
FE_ExcludeObjCMessageSend 
FE_ExcludeStaticLocalVars 
FE_ExcludeThreadLocalVars 

Definition at line 4730 of file Type.h.

◆ Kind

enum class clang::FunctionEffect::Kind : uint8_t
strong

Identifies the particular effect.

Enumerator
NonBlocking 
NonAllocating 
Blocking 
Allocating 
Last 

Definition at line 4719 of file Type.h.

Constructor & Destructor Documentation

◆ FunctionEffect()

clang::FunctionEffect::FunctionEffect ( Kind  K)
inlineexplicit

Definition at line 4752 of file Type.h.

Member Function Documentation

◆ effectProhibitingInference()

std::optional< FunctionEffect > FunctionEffect::effectProhibitingInference ( const Decl Callee,
FunctionEffectKindSet  CalleeFX 
) const

Determine whether the effect is allowed to be inferred on the callee, which is either a FunctionDecl or BlockDecl.

If the returned optional is empty, inference is permitted; otherwise it holds the effect which blocked inference. Example: This allows nonblocking(false) to prevent inference for the function.

Definition at line 5237 of file Type.cpp.

References Allocating, Blocking, kind(), NonAllocating, and NonBlocking.

◆ flags()

Flags clang::FunctionEffect::flags ( ) const
inline

Flags describing some behaviors of the effect.

Definition at line 4767 of file Type.h.

◆ fromOpaqueInt32()

static FunctionEffect clang::FunctionEffect::fromOpaqueInt32 ( uint32_t  Value)
inlinestatic

Definition at line 4762 of file Type.h.

References Kind.

Referenced by clang::serialization::DataStreamBasicReader< Impl >::readFunctionEffect().

◆ kind()

Kind clang::FunctionEffect::kind ( ) const
inline

◆ name()

StringRef FunctionEffect::name ( ) const

The description printed in diagnostics, e.g. 'nonblocking'.

Definition at line 5223 of file Type.cpp.

References Allocating, Blocking, kind(), NonAllocating, and NonBlocking.

Referenced by clang::FunctionEffectWithCondition::description(), and clang::TreeTransform< Derived >::TransformFunctionProtoType().

◆ oppositeKind()

FunctionEffect::Kind FunctionEffect::oppositeKind ( ) const

Return the opposite kind, for effects which have opposites.

Definition at line 5209 of file Type.cpp.

References Allocating, Blocking, kind(), NonAllocating, and NonBlocking.

Referenced by clang::FunctionEffectSet::insert(), and clang::TreeTransform< Derived >::TransformFunctionProtoType().

◆ shouldDiagnoseFunctionCall()

bool FunctionEffect::shouldDiagnoseFunctionCall ( bool  Direct,
FunctionEffectKindSet  CalleeFX 
) const

Definition at line 5261 of file Type.cpp.

References Allocating, Blocking, kind(), NonAllocating, and NonBlocking.

◆ toOpaqueInt32()

uint32_t clang::FunctionEffect::toOpaqueInt32 ( ) const
inline

For serialization.

Definition at line 4761 of file Type.h.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( FunctionEffect  LHS,
FunctionEffect  RHS 
)
friend

Definition at line 4813 of file Type.h.

◆ operator<

bool operator< ( FunctionEffect  LHS,
FunctionEffect  RHS 
)
friend

Definition at line 4816 of file Type.h.

◆ operator<<

raw_ostream & operator<< ( raw_ostream &  OS,
const FunctionEffect Effect 
)
friend

Definition at line 4787 of file Type.h.

◆ operator==

bool operator== ( FunctionEffect  LHS,
FunctionEffect  RHS 
)
friend

Definition at line 4810 of file Type.h.

Member Data Documentation

◆ KindCount

constexpr size_t clang::FunctionEffect::KindCount = static_cast<size_t>(Kind::Last) + 1
staticconstexpr

Definition at line 4726 of file Type.h.


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