Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/CodeGen/CGCleanup.cpp
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | for (EHScopeStack::iterator it = begin(); stabilize(it) != Old; it++) { | ||||
EHCleanupScope *cleanup = dyn_cast<EHCleanupScope>(&*it); | EHCleanupScope *cleanup = dyn_cast<EHCleanupScope>(&*it); | ||||
if (!cleanup || !cleanup->isLifetimeMarker()) | if (!cleanup || !cleanup->isLifetimeMarker()) | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool EHScopeStack::inTerminateScope() const { | |||||
return InnermostEHScope != stable_end() && | |||||
find(InnermostEHScope)->getKind() == EHScope::Terminate; | |||||
} | |||||
bool EHScopeStack::requiresLandingPad() const { | bool EHScopeStack::requiresLandingPad() const { | ||||
for (stable_iterator si = getInnermostEHScope(); si != stable_end(); ) { | for (stable_iterator si = getInnermostEHScope(); si != stable_end(); ) { | ||||
// Skip lifetime markers. | // Skip lifetime markers. | ||||
if (auto *cleanup = dyn_cast<EHCleanupScope>(&*find(si))) | if (auto *cleanup = dyn_cast<EHCleanupScope>(&*find(si))) | ||||
if (cleanup->isLifetimeMarker()) { | if (cleanup->isLifetimeMarker()) { | ||||
si = cleanup->getEnclosingEHScope(); | si = cleanup->getEnclosingEHScope(); | ||||
continue; | continue; | ||||
} | } | ||||
Show All 20 Lines | void *EHScopeStack::pushCleanup(CleanupKind Kind, size_t Size) { | ||||
bool IsNormalCleanup = Kind & NormalCleanup; | bool IsNormalCleanup = Kind & NormalCleanup; | ||||
bool IsEHCleanup = Kind & EHCleanup; | bool IsEHCleanup = Kind & EHCleanup; | ||||
bool IsLifetimeMarker = Kind & LifetimeMarker; | bool IsLifetimeMarker = Kind & LifetimeMarker; | ||||
// Per C++ [except.terminate], it is implementation-defined whether none, | // Per C++ [except.terminate], it is implementation-defined whether none, | ||||
// some, or all cleanups are called before std::terminate. Thus, when | // some, or all cleanups are called before std::terminate. Thus, when | ||||
// terminate is the current EH scope, we may skip adding any EH cleanup | // terminate is the current EH scope, we may skip adding any EH cleanup | ||||
// scopes. | // scopes. | ||||
if (InnermostEHScope != stable_end() && | if (inTerminateScope()) | ||||
find(InnermostEHScope)->getKind() == EHScope::Terminate) | |||||
IsEHCleanup = false; | IsEHCleanup = false; | ||||
EHCleanupScope *Scope = | EHCleanupScope *Scope = | ||||
new (Buffer) EHCleanupScope(IsNormalCleanup, | new (Buffer) EHCleanupScope(IsNormalCleanup, | ||||
IsEHCleanup, | IsEHCleanup, | ||||
Size, | Size, | ||||
BranchFixups.size(), | BranchFixups.size(), | ||||
InnermostNormalCleanup, | InnermostNormalCleanup, | ||||
▲ Show 20 Lines • Show All 1,182 Lines • Show Last 20 Lines |