- void setEHState(int State) { EHState = State; }
- int getEHState() const { return EHState; }
-
-private:
- BasicBlock *StartBB;
- ActionType Type;
- int EHState;
-
- // Can be either a BlockAddress or a Function depending on the EH personality.
- Constant *HandlerBlockOrFunc;
-};
-
-class CatchHandler : public ActionHandler {
-public:
- CatchHandler(BasicBlock *BB, Constant *Selector, BasicBlock *NextBB)
- : ActionHandler(BB, ActionType::Catch), Selector(Selector),
- NextBB(NextBB), ExceptionObjectVar(nullptr),
- ExceptionObjectIndex(-1) {}
-
- // Method for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ActionHandler *H) {
- return H->getType() == ActionType::Catch;
- }
-
- Constant *getSelector() const { return Selector; }
- BasicBlock *getNextBB() const { return NextBB; }
-
- const Value *getExceptionVar() { return ExceptionObjectVar; }
- TinyPtrVector<BasicBlock *> &getReturnTargets() { return ReturnTargets; }
-
- void setExceptionVar(const Value *Val) { ExceptionObjectVar = Val; }
- void setExceptionVarIndex(int Index) { ExceptionObjectIndex = Index; }
- int getExceptionVarIndex() const { return ExceptionObjectIndex; }
- void setReturnTargets(TinyPtrVector<BasicBlock *> &Targets) {
- ReturnTargets = Targets;
- }
-
-private:
- Constant *Selector;
- BasicBlock *NextBB;
- // While catch handlers are being outlined the ExceptionObjectVar field will
- // be populated with the instruction in the parent frame that corresponds
- // to the exception object (or nullptr if the catch does not use an
- // exception object) and the ExceptionObjectIndex field will be -1.
- // When the parseEHActions function is called to populate a vector of
- // instances of this class, the ExceptionObjectVar field will be nullptr
- // and the ExceptionObjectIndex will be the index of the exception object in
- // the parent function's frameescape block.
- const Value *ExceptionObjectVar;
- int ExceptionObjectIndex;
- TinyPtrVector<BasicBlock *> ReturnTargets;