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.
 

Public Member Functions

 FunctionEffect ()
 
 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'.
 
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.
 
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 4708 of file Type.h.

Member Typedef Documentation

◆ Flags

Flags describing some behaviors of the effect.

Definition at line 4720 of file Type.h.

Member Enumeration Documentation

◆ FlagBit

Enumerator
FE_InferrableOnCallees 
FE_ExcludeThrow 
FE_ExcludeCatch 
FE_ExcludeObjCMessageSend 
FE_ExcludeStaticLocalVars 
FE_ExcludeThreadLocalVars 

Definition at line 4721 of file Type.h.

◆ Kind

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

Identifies the particular effect.

Enumerator
None 
NonBlocking 
NonAllocating 
Blocking 
Allocating 

Definition at line 4711 of file Type.h.

Constructor & Destructor Documentation

◆ FunctionEffect() [1/2]

clang::FunctionEffect::FunctionEffect ( )
inline

Definition at line 4743 of file Type.h.

◆ FunctionEffect() [2/2]

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

Definition at line 4745 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 5140 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 4760 of file Type.h.

◆ fromOpaqueInt32()

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

Definition at line 4755 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 5124 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 5108 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 5174 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 4754 of file Type.h.

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 4798 of file Type.h.

◆ operator<

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

Definition at line 4801 of file Type.h.

◆ operator==

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

Definition at line 4795 of file Type.h.


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