clang  20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | 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 {
  None = 0 , NonBlocking = 1 , NonAllocating = 2 , Blocking = 3 ,
  Allocating = 4
}
 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. More...
 

Public Member Functions

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

Static Public Member Functions

static FunctionEffect fromOpaqueInt32 (uint32_t Value)
 

Friends

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

Detailed Description

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

Definition at line 4713 of file Type.h.

Member Typedef Documentation

◆ Flags

Flags describing some behaviors of the effect.

Definition at line 4725 of file Type.h.

Member Enumeration Documentation

◆ FlagBit

Enumerator
FE_InferrableOnCallees 
FE_ExcludeThrow 
FE_ExcludeCatch 
FE_ExcludeObjCMessageSend 
FE_ExcludeStaticLocalVars 
FE_ExcludeThreadLocalVars 

Definition at line 4726 of file Type.h.

◆ Kind

enum clang::FunctionEffect::Kind : uint8_t
strong

Identifies the particular effect.

Enumerator
None 
NonBlocking 
NonAllocating 
Blocking 
Allocating 

Definition at line 4716 of file Type.h.

Constructor & Destructor Documentation

◆ FunctionEffect() [1/2]

clang::FunctionEffect::FunctionEffect ( )
inline

Definition at line 4748 of file Type.h.

◆ FunctionEffect() [2/2]

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

Definition at line 4750 of file Type.h.

Member Function Documentation

◆ canInferOnFunction()

bool FunctionEffect::canInferOnFunction ( const Decl Callee) const

Return true if the effect is allowed to be inferred on the callee, which is either a FunctionDecl or BlockDecl.

Example: This allows nonblocking(false) to prevent inference for the function.

Definition at line 5151 of file Type.cpp.

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

◆ flags()

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

Flags describing some behaviors of the effect.

Definition at line 4765 of file Type.h.

References clang::XRayInstrKind::None.

◆ fromOpaqueInt32()

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

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

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

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

◆ oppositeKind()

FunctionEffect::Kind FunctionEffect::oppositeKind ( ) const

Return the opposite kind, for effects which have opposites.

Definition at line 5119 of file Type.cpp.

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

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

◆ shouldDiagnoseFunctionCall()

bool FunctionEffect::shouldDiagnoseFunctionCall ( bool  Direct,
ArrayRef< FunctionEffect CalleeFX 
) const

Definition at line 5185 of file Type.cpp.

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

◆ toOpaqueInt32()

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

For serialization.

Definition at line 4759 of file Type.h.

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 4803 of file Type.h.

◆ operator<

bool operator< ( const FunctionEffect LHS,
const FunctionEffect RHS 
)
friend

Definition at line 4806 of file Type.h.

◆ operator==

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

Definition at line 4800 of file Type.h.


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