clang 20.0.0git
|
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< 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. | |
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) |
Represents an abstract function effect, using just an enumeration describing its kind.
using clang::FunctionEffect::Flags = unsigned |
|
strong |
|
inlineexplicit |
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.
|
inline |
|
inlinestatic |
Definition at line 4762 of file Type.h.
References Kind.
Referenced by clang::serialization::DataStreamBasicReader< Impl >::readFunctionEffect().
|
inline |
The kind of the effect.
Definition at line 4755 of file Type.h.
Referenced by clang::Sema::diagnoseConflictingFunctionEffect(), effectProhibitingInference(), clang::Sema::FunctionEffectDiffVector::FunctionEffectDiffVector(), clang::FunctionEffectSet::insert(), clang::FunctionEffectKindSet::insert(), name(), oppositeKind(), and shouldDiagnoseFunctionCall().
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().
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().
bool FunctionEffect::shouldDiagnoseFunctionCall | ( | bool | Direct, |
FunctionEffectKindSet | CalleeFX | ||
) | const |
Definition at line 5261 of file Type.cpp.
References Allocating, Blocking, kind(), NonAllocating, and NonBlocking.
|
inline |
|
friend |
|
friend |
|
friend |
|
friend |
|
staticconstexpr |