summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-04-01 05:20:42 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-04-01 05:20:42 +0000
commite8eb9e6de3b75890c83b6a9f83de9cc8ed60f073 (patch)
tree8e9255b9fbd786cd947059e11360067728feef66 /llvm/lib/CodeGen
parent1f192e26fd5471035bee2a721340f2344873d625 (diff)
downloadbcm5719-llvm-e8eb9e6de3b75890c83b6a9f83de9cc8ed60f073.tar.gz
bcm5719-llvm-e8eb9e6de3b75890c83b6a9f83de9cc8ed60f073.zip
[WinEH] Implement support for catch-all
A catch (...) doesn't have a type descriptor. Instead, the 'adjectives' field has bit six set. llvm-svn: 233788
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index 64af04087e7..47bce8987c8 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -335,14 +335,19 @@ void WinEHNumbering::createTryBlockMapEntry(int TryLow, int TryHigh,
assert(TBME.CatchHigh > TBME.TryHigh);
for (CatchHandler *CH : Handlers) {
WinEHHandlerType HT;
- auto *GV = cast<GlobalVariable>(CH->getSelector()->stripPointerCasts());
- // Selectors are always pointers to GlobalVariables with 'struct' type.
- // The struct has two fields, adjectives and a type descriptor.
- auto *CS = cast<ConstantStruct>(GV->getInitializer());
- HT.Adjectives =
- cast<ConstantInt>(CS->getAggregateElement(0U))->getZExtValue();
- HT.TypeDescriptor = cast<GlobalVariable>(
- CS->getAggregateElement(1)->stripPointerCasts());
+ if (CH->getSelector()->isNullValue()) {
+ HT.Adjectives = 0x40;
+ HT.TypeDescriptor = nullptr;
+ } else {
+ auto *GV = cast<GlobalVariable>(CH->getSelector()->stripPointerCasts());
+ // Selectors are always pointers to GlobalVariables with 'struct' type.
+ // The struct has two fields, adjectives and a type descriptor.
+ auto *CS = cast<ConstantStruct>(GV->getInitializer());
+ HT.Adjectives =
+ cast<ConstantInt>(CS->getAggregateElement(0U))->getZExtValue();
+ HT.TypeDescriptor =
+ cast<GlobalVariable>(CS->getAggregateElement(1)->stripPointerCasts());
+ }
HT.Handler = cast<Function>(CH->getHandlerBlockOrFunc());
// FIXME: We don't support catching objects yet!
HT.CatchObjIdx = INT_MAX;
OpenPOWER on IntegriCloud