diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-04 14:14:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-04 14:14:44 +0200 |
commit | 0aa9007705231b72616c533aeed6a28ca3349999 (patch) | |
tree | dc6b1ec0be309a4ebd71b23625ec0711aad9555e | |
parent | 06dc23bd590d003eca6109890974ca96ed6fd1a4 (diff) |
Add support for "emplacing" file/line/column into location in diagnostics
-rw-r--r-- | bpkg/diagnostics | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bpkg/diagnostics b/bpkg/diagnostics index d1183d2..85eef2b 100644 --- a/bpkg/diagnostics +++ b/bpkg/diagnostics @@ -263,6 +263,18 @@ namespace bpkg return location_prologue (type_, name_, get_location (l, data_)); } + template <typename F, typename L, typename C> + location_prologue + operator() (F&& f, L&& l, C&& c) const + { + return location_prologue ( + type_, + name_, + location (std::forward<F> (f), + std::forward<L> (l), + std::forward<C> (c))); + } + protected: const char* type_; const char* name_; @@ -315,6 +327,19 @@ namespace bpkg &epilogue, "error", nullptr, get_location (l, data_)); } + template <typename F, typename L, typename C> + location_prologue + operator() (F&& f, L&& l, C&& c) const + { + return location_prologue ( + &epilogue, + "error", + nullptr, + location (std::forward<F> (f), + std::forward<L> (l), + std::forward<C> (c))); + } + static void epilogue (const diag_record&) {throw E ();} |