clang 20.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
clang::CodeGen::EHScopeStack Class Reference

A stack of scopes which respond to exceptions, including cleanups and catch blocks. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/EHScopeStack.h"

Classes

class  Cleanup
 Information for lazily generating a cleanup. More...
 
class  ConditionalCleanup
 ConditionalCleanup stores the saved form of its parameters, then restores them and performs the cleanup. More...
 
class  iterator
 A non-stable pointer into the scope stack. More...
 
class  stable_iterator
 A saved depth on the scope stack. More...
 

Public Types

enum  { ScopeStackAlignment = 8 }
 

Public Member Functions

 EHScopeStack ()
 
 ~EHScopeStack ()
 
 EHScopeStack (const EHScopeStack &)=delete
 
EHScopeStackoperator= (const EHScopeStack &)=delete
 
template<class T , class... As>
void pushCleanup (CleanupKind Kind, As... A)
 Push a lazily-created cleanup on the stack.
 
template<class T , class... As>
void pushCleanupTuple (CleanupKind Kind, std::tuple< As... > A)
 Push a lazily-created cleanup on the stack. Tuple version.
 
template<class T , class... As>
TpushCleanupWithExtra (CleanupKind Kind, size_t N, As... A)
 Push a cleanup with non-constant storage requirements on the stack.
 
void pushCopyOfCleanup (CleanupKind Kind, const void *Cleanup, size_t Size)
 
void setCGF (CodeGenFunction *inCGF)
 
void popCleanup ()
 Pops a cleanup scope off the stack. This is private to CGCleanup.cpp.
 
class EHCatchScopepushCatch (unsigned NumHandlers)
 Push a set of catch handlers on the stack.
 
void popCatch ()
 Pops a catch scope off the stack. This is private to CGException.cpp.
 
class EHFilterScopepushFilter (unsigned NumFilters)
 Push an exceptions filter on the stack.
 
void popFilter ()
 Pops an exceptions filter off the stack.
 
void pushTerminate ()
 Push a terminate handler on the stack.
 
void popTerminate ()
 Pops a terminate handler off the stack.
 
bool containsOnlyLifetimeMarkers (stable_iterator Old) const
 
bool empty () const
 Determines whether the exception-scopes stack is empty.
 
bool requiresLandingPad () const
 
bool hasNormalCleanups () const
 Determines whether there are any normal cleanups on the stack.
 
stable_iterator getInnermostNormalCleanup () const
 Returns the innermost normal cleanup on the stack, or stable_end() if there are no normal cleanups.
 
stable_iterator getInnermostActiveNormalCleanup () const
 
stable_iterator getInnermostEHScope () const
 
iterator begin () const
 Returns an iterator pointing to the innermost EH scope.
 
iterator end () const
 Returns an iterator pointing to the outermost EH scope.
 
stable_iterator stable_begin () const
 Create a stable reference to the top of the EH stack.
 
stable_iterator stabilize (iterator it) const
 Translates an iterator into a stable_iterator.
 
iterator find (stable_iterator save) const
 Turn a stable reference to a scope depth into a unstable pointer to the EH stack.
 
BranchFixupaddBranchFixup ()
 Add a branch fixup to the current cleanup scope.
 
unsigned getNumBranchFixups () const
 
BranchFixupgetBranchFixup (unsigned I)
 
void popNullFixups ()
 Pops lazily-removed fixups from the end of the list.
 
void clearFixups ()
 Clears the branch-fixups list.
 

Static Public Member Functions

static stable_iterator stable_end ()
 Create a stable reference to the bottom of the EH stack.
 

Detailed Description

A stack of scopes which respond to exceptions, including cleanups and catch blocks.

Definition at line 94 of file EHScopeStack.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ScopeStackAlignment 

Definition at line 97 of file EHScopeStack.h.

Constructor & Destructor Documentation

◆ EHScopeStack() [1/2]

clang::CodeGen::EHScopeStack::EHScopeStack ( )
inline

Definition at line 275 of file EHScopeStack.h.

◆ ~EHScopeStack()

clang::CodeGen::EHScopeStack::~EHScopeStack ( )
inline

Definition at line 279 of file EHScopeStack.h.

◆ EHScopeStack() [2/2]

clang::CodeGen::EHScopeStack::EHScopeStack ( const EHScopeStack )
delete

Member Function Documentation

◆ addBranchFixup()

BranchFixup & clang::CodeGen::EHScopeStack::addBranchFixup ( )
inline

Add a branch fixup to the current cleanup scope.

Definition at line 410 of file EHScopeStack.h.

References hasNormalCleanups().

◆ begin()

EHScopeStack::iterator clang::CodeGen::EHScopeStack::begin ( ) const
inline

Returns an iterator pointing to the innermost EH scope.

Definition at line 615 of file CGCleanup.h.

Referenced by containsOnlyLifetimeMarkers(), clang::CodeGen::CodeGenFunction::FinallyInfo::exit(), popCatch(), popCleanup(), popFilter(), and popTerminate().

◆ clearFixups()

void clang::CodeGen::EHScopeStack::clearFixups ( )
inline

Clears the branch-fixups list.

This should only be called by ResolveAllBranchFixups.

Definition at line 429 of file EHScopeStack.h.

Referenced by ResolveAllBranchFixups().

◆ containsOnlyLifetimeMarkers()

bool EHScopeStack::containsOnlyLifetimeMarkers ( EHScopeStack::stable_iterator  Old) const

Definition at line 115 of file CGCleanup.cpp.

References begin(), and stabilize().

◆ empty()

bool clang::CodeGen::EHScopeStack::empty ( ) const
inline

Determines whether the exception-scopes stack is empty.

Definition at line 359 of file EHScopeStack.h.

Referenced by popCatch(), popCleanup(), popFilter(), and popTerminate().

◆ end()

EHScopeStack::iterator clang::CodeGen::EHScopeStack::end ( ) const
inline

Returns an iterator pointing to the outermost EH scope.

Definition at line 619 of file CGCleanup.h.

◆ find()

EHScopeStack::iterator clang::CodeGen::EHScopeStack::find ( stable_iterator  save) const
inline

Turn a stable reference to a scope depth into a unstable pointer to the EH stack.

Definition at line 639 of file CGCleanup.h.

References clang::CodeGen::EHScopeStack::stable_iterator::isValid(), and stable_begin().

Referenced by getInnermostActiveNormalCleanup(), IsUsedAsEHCleanup(), popNullFixups(), requiresLandingPad(), and SetupCleanupBlockActivation().

◆ getBranchFixup()

BranchFixup & clang::CodeGen::EHScopeStack::getBranchFixup ( unsigned  I)
inline

Definition at line 417 of file EHScopeStack.h.

References getNumBranchFixups().

Referenced by ResolveAllBranchFixups().

◆ getInnermostActiveNormalCleanup()

EHScopeStack::stable_iterator EHScopeStack::getInnermostActiveNormalCleanup ( ) const

Definition at line 141 of file CGCleanup.cpp.

References find(), getInnermostNormalCleanup(), and stable_end().

◆ getInnermostEHScope()

stable_iterator clang::CodeGen::EHScopeStack::getInnermostEHScope ( ) const
inline

Definition at line 375 of file EHScopeStack.h.

Referenced by IsUsedAsEHCleanup(), pushFilter(), and requiresLandingPad().

◆ getInnermostNormalCleanup()

stable_iterator clang::CodeGen::EHScopeStack::getInnermostNormalCleanup ( ) const
inline

Returns the innermost normal cleanup on the stack, or stable_end() if there are no normal cleanups.

Definition at line 370 of file EHScopeStack.h.

Referenced by getInnermostActiveNormalCleanup(), clang::CodeGen::CodeGenFunction::getJumpDestInCurrentScope(), and clang::CodeGen::CodeGenFunction::LexicalScope::rescopeLabels().

◆ getNumBranchFixups()

unsigned clang::CodeGen::EHScopeStack::getNumBranchFixups ( ) const
inline

Definition at line 416 of file EHScopeStack.h.

Referenced by getBranchFixup(), and ResolveAllBranchFixups().

◆ hasNormalCleanups()

bool clang::CodeGen::EHScopeStack::hasNormalCleanups ( ) const
inline

Determines whether there are any normal cleanups on the stack.

Definition at line 364 of file EHScopeStack.h.

References stable_end().

Referenced by addBranchFixup(), popCleanup(), and popNullFixups().

◆ operator=()

EHScopeStack & clang::CodeGen::EHScopeStack::operator= ( const EHScopeStack )
delete

◆ popCatch()

void clang::CodeGen::EHScopeStack::popCatch ( )
inline

◆ popCleanup()

void EHScopeStack::popCleanup ( )

Pops a cleanup scope off the stack. This is private to CGCleanup.cpp.

Definition at line 193 of file CGCleanup.cpp.

References begin(), empty(), hasNormalCleanups(), and popNullFixups().

◆ popFilter()

void EHScopeStack::popFilter ( )

◆ popNullFixups()

void EHScopeStack::popNullFixups ( )

Pops lazily-removed fixups from the end of the list.

Remove any 'null' fixups on the stack.

This should only be called by procedures which have just popped a cleanup or resolved one or more fixups.

However, we can't pop more fixups than the fixup depth on the innermost normal cleanup, or else fixups that we try to add to that cleanup will end up in the wrong place. We could try to shrink fixup depths, but that's actually a lot of work for little benefit.

Definition at line 254 of file CGCleanup.cpp.

References find(), and hasNormalCleanups().

Referenced by popCleanup().

◆ popTerminate()

void clang::CodeGen::EHScopeStack::popTerminate ( )
inline

Pops a terminate handler off the stack.

Definition at line 631 of file CGCleanup.h.

References begin(), empty(), clang::CodeGen::EHScope::getEnclosingEHScope(), and clang::CodeGen::EHTerminateScope::getSize().

Referenced by InitCatchParam().

◆ pushCatch()

EHCatchScope * EHScopeStack::pushCatch ( unsigned  NumHandlers)

Push a set of catch handlers on the stack.

The catch is uninitialized and will need to have the given number of handlers set on it.

Definition at line 235 of file CGCleanup.cpp.

References clang::CodeGen::EHCatchScope::getSizeForNumHandlers(), and stable_begin().

Referenced by clang::CodeGen::CGObjCRuntime::EmitTryCatchStmt(), and clang::CodeGen::CodeGenFunction::FinallyInfo::enter().

◆ pushCleanup()

template<class T , class... As>
void clang::CodeGen::EHScopeStack::pushCleanup ( CleanupKind  Kind,
As...  A 
)
inline

Push a lazily-created cleanup on the stack.

Definition at line 285 of file EHScopeStack.h.

References Kind, ScopeStackAlignment, and clang::T.

◆ pushCleanupTuple()

template<class T , class... As>
void clang::CodeGen::EHScopeStack::pushCleanupTuple ( CleanupKind  Kind,
std::tuple< As... >  A 
)
inline

Push a lazily-created cleanup on the stack. Tuple version.

Definition at line 295 of file EHScopeStack.h.

References Kind, ScopeStackAlignment, and clang::T.

Referenced by clang::CodeGen::CodeGenFunction::pushFullExprCleanup().

◆ pushCleanupWithExtra()

template<class T , class... As>
T * clang::CodeGen::EHScopeStack::pushCleanupWithExtra ( CleanupKind  Kind,
size_t  N,
As...  A 
)
inline

Push a cleanup with non-constant storage requirements on the stack.

The cleanup type must provide an additional static method: static size_t getExtraSize(size_t); The argument to this method will be the value N, which will also be passed as the first argument to the constructor.

The data stored in the extra storage must obey the same restrictions as normal cleanup member data.

The pointer returned from this method is valid until the cleanup stack is modified.

Definition at line 317 of file EHScopeStack.h.

References Kind, ScopeStackAlignment, and clang::T.

Referenced by EnterNewDeleteCleanup().

◆ pushCopyOfCleanup()

void clang::CodeGen::EHScopeStack::pushCopyOfCleanup ( CleanupKind  Kind,
const void *  Cleanup,
size_t  Size 
)
inline

Definition at line 324 of file EHScopeStack.h.

References Kind.

◆ pushFilter()

EHFilterScope * EHScopeStack::pushFilter ( unsigned  NumFilters)

Push an exceptions filter on the stack.

Definition at line 218 of file CGCleanup.cpp.

References getInnermostEHScope(), clang::CodeGen::EHFilterScope::getSizeForNumFilters(), stable_begin(), and stable_end().

◆ pushTerminate()

void EHScopeStack::pushTerminate ( )

Push a terminate handler on the stack.

Definition at line 243 of file CGCleanup.cpp.

References clang::CodeGen::EHTerminateScope::getSize(), and stable_begin().

Referenced by InitCatchParam().

◆ requiresLandingPad()

bool EHScopeStack::requiresLandingPad ( ) const

◆ setCGF()

void clang::CodeGen::EHScopeStack::setCGF ( CodeGenFunction inCGF)
inline

Definition at line 329 of file EHScopeStack.h.

◆ stabilize()

EHScopeStack::stable_iterator clang::CodeGen::EHScopeStack::stabilize ( iterator  it) const
inline

Translates an iterator into a stable_iterator.

Definition at line 646 of file CGCleanup.h.

Referenced by containsOnlyLifetimeMarkers().

◆ stable_begin()

stable_iterator clang::CodeGen::EHScopeStack::stable_begin ( ) const
inline

Create a stable reference to the top of the EH stack.

The returned reference is valid until that scope is popped off the stack.

Definition at line 393 of file EHScopeStack.h.

Referenced by find(), pushCatch(), clang::CodeGen::CodeGenFunction::pushCleanupAndDeferDeactivation(), pushFilter(), pushTerminate(), clang::CodeGen::CodeGenFunction::RunCleanupsScope::requiresCleanups(), and clang::CodeGen::CodeGenFunction::RunCleanupsScope::RunCleanupsScope().

◆ stable_end()

static stable_iterator clang::CodeGen::EHScopeStack::stable_end ( )
inlinestatic

Create a stable reference to the bottom of the EH stack.

Definition at line 398 of file EHScopeStack.h.

Referenced by getInnermostActiveNormalCleanup(), hasNormalCleanups(), pushFilter(), requiresLandingPad(), and clang::CodeGen::CodeGenFunction::LexicalScope::rescopeLabels().


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