aboutsummaryrefslogtreecommitdiff
path: root/include/cps
diff options
context:
space:
mode:
Diffstat (limited to 'include/cps')
-rw-r--r--include/cps/FunctionGen.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/cps/FunctionGen.h b/include/cps/FunctionGen.h
index 6c5c7c0..f5e5ba2 100644
--- a/include/cps/FunctionGen.h
+++ b/include/cps/FunctionGen.h
@@ -86,6 +86,7 @@ private:
std::function<void(const FuncSig &)> BeforeCall;
ArrayParamBinder BindArrayParam;
std::function<void(llvm::Value *, const std::string &, int)> RegisterCopy;
+ std::function<void(int, const std::string &)> MissingReturn;
ClangABI ABI{Context, Types}; // clang context created on the first EXTERN
void createArgumentAllocas(llvm::Function *F, const std::vector<ParamDecl> &Params, bool IsMethod);
@@ -105,6 +106,12 @@ public:
void setArrayParamBinder(ArrayParamBinder Binder) { BindArrayParam = std::move(Binder); }
+ // Called (with the FUNCTION header line and name) where a non-VOID FUNCTION
+ // body can fall off its end; emits the runtime error and throw.
+ void setMissingReturnHandler(std::function<void(int, const std::string &)> Handler) {
+ MissingReturn = std::move(Handler);
+ }
+
void setCopyRegistrar(std::function<void(llvm::Value *, const std::string &, int)> Registrar) {
RegisterCopy = std::move(Registrar);
}