clang 22.0.0git
clang::FunctionEffect Class Reference

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

#include "clang/AST/TypeBase.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 4877 of file TypeBase.h.

Member Typedef Documentation

◆ Flags

Flags describing some behaviors of the effect.

Definition at line 4890 of file TypeBase.h.

Member Enumeration Documentation

◆ FlagBit

Enumerator
FE_InferrableOnCallees 
FE_ExcludeThrow 
FE_ExcludeCatch 
FE_ExcludeObjCMessageSend 
FE_ExcludeStaticLocalVars 
FE_ExcludeThreadLocalVars 

Definition at line 4891 of file TypeBase.h.

◆ Kind

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

Identifies the particular effect.

Enumerator
NonBlocking 
NonAllocating 
Blocking 
Allocating 
Last 

Definition at line 4880 of file TypeBase.h.

Constructor & Destructor Documentation

◆ FunctionEffect()

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

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 5543 of file Type.cpp.

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

◆ flags()

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

◆ fromOpaqueInt32()

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

◆ kind()

◆ name()

StringRef FunctionEffect::name ( ) const

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

Definition at line 5529 of file Type.cpp.

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

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

◆ oppositeKind()

FunctionEffect::Kind FunctionEffect::oppositeKind ( ) const

Return the opposite kind, for effects which have opposites.

Definition at line 5515 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 5567 of file Type.cpp.

References Allocating, Blocking, clang::Direct, FunctionEffect(), kind(), NonAllocating, and NonBlocking.

◆ toOpaqueInt32()

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

For serialization.

Definition at line 4922 of file TypeBase.h.

Referenced by clang::serialization::DataStreamBasicWriter< Impl >::writeFunctionEffect().

◆ operator!=

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

Definition at line 4974 of file TypeBase.h.

References FunctionEffect().

◆ operator<

bool operator< ( FunctionEffect LHS,
FunctionEffect RHS )
friend

Definition at line 4977 of file TypeBase.h.

References FunctionEffect().

◆ operator<<

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

Definition at line 4948 of file TypeBase.h.

References FunctionEffect(), and name().

◆ operator==

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

Definition at line 4971 of file TypeBase.h.

References FunctionEffect().

Member Data Documentation

◆ KindCount

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

Definition at line 4887 of file TypeBase.h.


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