diff options
author | Ben Burdette <bburdette@protonmail.com> | 2022-04-28 12:32:57 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@protonmail.com> | 2022-04-28 12:32:57 -0600 |
commit | 6e19947993119dec3c9fb9581150d1184948bae9 (patch) | |
tree | 978fd122eb69168974a3a90063114b97b976f8f3 /src/libexpr/eval-inline.hh | |
parent | 93b8d315087921b0a024bf87555ac6c3bca6882d (diff) | |
parent | 4bb111c8d4c5692db2f735c2803f632f8c30b6ab (diff) |
Merge branch 'master' into debug-merge-master
Diffstat (limited to 'src/libexpr/eval-inline.hh')
-rw-r--r-- | src/libexpr/eval-inline.hh | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/src/libexpr/eval-inline.hh b/src/libexpr/eval-inline.hh index 9b0073822..4e0826101 100644 --- a/src/libexpr/eval-inline.hh +++ b/src/libexpr/eval-inline.hh @@ -2,42 +2,8 @@ #include "eval.hh" -#define LocalNoInline(f) static f __attribute__((noinline)); f -#define LocalNoInlineNoReturn(f) static f __attribute__((noinline, noreturn)); f - namespace nix { -LocalNoInlineNoReturn(void throwEvalError(const Pos & pos, const char * s, EvalState &evalState)) -{ - auto error = EvalError({ - .msg = hintfmt(s), - .errPos = pos - }); - - if (debuggerHook && !evalState.debugTraces.empty()) { - DebugTrace &last = evalState.debugTraces.front(); - debuggerHook(&error, last.env, last.expr); - } - - throw error; -} - -LocalNoInlineNoReturn(void throwTypeError(const Pos & pos, const char * s, const Value & v, EvalState &evalState)) -{ - auto error = TypeError({ - .msg = hintfmt(s, showType(v)), - .errPos = pos - }); - - if (debuggerHook && !evalState.debugTraces.empty()) { - DebugTrace &last = evalState.debugTraces.front(); - debuggerHook(&error, last.env, last.expr); - } - - throw error; -} - - /* Note: Various places expect the allocated memory to be zeroed. */ [[gnu::always_inline]] inline void * allocBytes(size_t n) @@ -113,7 +79,7 @@ Env & EvalState::allocEnv(size_t size) [[gnu::always_inline]] -void EvalState::forceValue(Value & v, const Pos & pos) +void EvalState::forceValue(Value & v, const PosIdx pos) { forceValue(v, [&]() { return pos; }); } @@ -142,7 +108,7 @@ void EvalState::forceValue(Value & v, Callable getPos) [[gnu::always_inline]] -inline void EvalState::forceAttrs(Value & v, const Pos & pos) +inline void EvalState::forceAttrs(Value & v, const PosIdx pos) { forceAttrs(v, [&]() { return pos; }); } @@ -159,7 +125,7 @@ inline void EvalState::forceAttrs(Value & v, Callable getPos) [[gnu::always_inline]] -inline void EvalState::forceList(Value & v, const Pos & pos) +inline void EvalState::forceList(Value & v, const PosIdx pos) { forceValue(v, pos); if (!v.isList()) |