summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCleanup.h
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-07-31 17:58:45 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-07-31 17:58:45 +0000
commitdbf1045ad75c41e0711e075cf9e0ffd433c55c67 (patch)
treec75cc12748d00898b082c1e1d556af59ec43ab8d /clang/lib/CodeGen/CGCleanup.h
parent654e130b6ec76c1a2910b2594cb403ecd2773af8 (diff)
downloadbcm5719-llvm-dbf1045ad75c41e0711e075cf9e0ffd433c55c67.tar.gz
bcm5719-llvm-dbf1045ad75c41e0711e075cf9e0ffd433c55c67.zip
[MS ABI] Hook clang up to the new EH instructions
The new EH instructions make it possible for LLVM to generate .xdata tables that the MSVC personality routines will be happy about. Because this is experimental, hide it behind a -cc1 flag (-fnew-ms-eh). Differential Revision: http://reviews.llvm.org/D11405 llvm-svn: 243767
Diffstat (limited to 'clang/lib/CodeGen/CGCleanup.h')
-rw-r--r--clang/lib/CodeGen/CGCleanup.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGCleanup.h b/clang/lib/CodeGen/CGCleanup.h
index 8338691ab5d..dcbc40db873 100644
--- a/clang/lib/CodeGen/CGCleanup.h
+++ b/clang/lib/CodeGen/CGCleanup.h
@@ -40,9 +40,9 @@ class EHScope {
class CommonBitFields {
friend class EHScope;
- unsigned Kind : 2;
+ unsigned Kind : 3;
};
- enum { NumCommonBits = 2 };
+ enum { NumCommonBits = 3 };
protected:
class CatchBitFields {
@@ -81,7 +81,7 @@ protected:
/// The number of fixups required by enclosing scopes (not including
/// this one). If this is the top cleanup scope, all the fixups
/// from this index onwards belong to this scope.
- unsigned FixupDepth : 32 - 18 - NumCommonBits; // currently 13
+ unsigned FixupDepth : 32 - 18 - NumCommonBits; // currently 12
};
class FilterBitFields {
@@ -99,7 +99,7 @@ protected:
};
public:
- enum Kind { Cleanup, Catch, Terminate, Filter };
+ enum Kind { Cleanup, Catch, Terminate, Filter, CatchEnd };
EHScope(Kind kind, EHScopeStack::stable_iterator enclosingEHScope)
: CachedLandingPad(nullptr), CachedEHDispatchBlock(nullptr),
@@ -466,6 +466,17 @@ public:
}
};
+class EHCatchEndScope : public EHScope {
+public:
+ EHCatchEndScope(EHScopeStack::stable_iterator enclosingEHScope)
+ : EHScope(CatchEnd, enclosingEHScope) {}
+ static size_t getSize() { return sizeof(EHCatchEndScope); }
+
+ static bool classof(const EHScope *scope) {
+ return scope->getKind() == CatchEnd;
+ }
+};
+
/// A non-stable pointer into the scope stack.
class EHScopeStack::iterator {
char *Ptr;
@@ -503,6 +514,10 @@ public:
case EHScope::Terminate:
Size = EHTerminateScope::getSize();
break;
+
+ case EHScope::CatchEnd:
+ Size = EHCatchEndScope::getSize();
+ break;
}
Ptr += llvm::RoundUpToAlignment(Size, ScopeStackAlignment);
return *this;
@@ -551,6 +566,14 @@ inline void EHScopeStack::popTerminate() {
deallocate(EHTerminateScope::getSize());
}
+inline void EHScopeStack::popCatchEnd() {
+ assert(!empty() && "popping exception stack when not empty");
+
+ EHCatchEndScope &scope = cast<EHCatchEndScope>(*begin());
+ InnermostEHScope = scope.getEnclosingEHScope();
+ deallocate(EHCatchEndScope::getSize());
+}
+
inline EHScopeStack::iterator EHScopeStack::find(stable_iterator sp) const {
assert(sp.isValid() && "finding invalid savepoint");
assert(sp.Size <= stable_begin().Size && "finding savepoint after pop");
@@ -588,6 +611,13 @@ struct EHPersonality {
static const EHPersonality MSVC_except_handler;
static const EHPersonality MSVC_C_specific_handler;
static const EHPersonality MSVC_CxxFrameHandler3;
+
+ bool isMSVCPersonality() const {
+ return this == &MSVC_except_handler || this == &MSVC_C_specific_handler ||
+ this == &MSVC_CxxFrameHandler3;
+ }
+
+ bool isMSVCXXPersonality() const { return this == &MSVC_CxxFrameHandler3; }
};
}
}
OpenPOWER on IntegriCloud