aboutsummaryrefslogtreecommitdiff
path: root/build/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'build/diagnostics')
-rw-r--r--build/diagnostics23
1 files changed, 17 insertions, 6 deletions
diff --git a/build/diagnostics b/build/diagnostics
index f85d118..7e56fa3 100644
--- a/build/diagnostics
+++ b/build/diagnostics
@@ -238,15 +238,17 @@ namespace build
private:
const char* type_;
const char* name_;
- const location& loc_;
+ const location loc_;
};
typedef diag_prologue<location_prologue_base> location_prologue;
struct basic_mark_base
{
explicit
- basic_mark_base (const char* type, const char* name = nullptr)
- : type_ (type), name_ (name) {}
+ basic_mark_base (const char* type,
+ const char* name = nullptr,
+ const void* data = nullptr)
+ : type_ (type), name_ (name), data_ (data) {}
simple_prologue
operator() () const
@@ -264,12 +266,13 @@ namespace build
location_prologue
operator() (const L& l) const
{
- return location_prologue (type_, name_, get_location (l));
+ return location_prologue (type_, name_, get_location (l, data_));
}
private:
const char* type_;
const char* name_;
+ const void* data_;
};
typedef diag_mark<basic_mark_base> basic_mark;
@@ -281,7 +284,8 @@ namespace build
struct trace_mark_base: basic_mark_base
{
explicit
- trace_mark_base (const char* name): basic_mark_base ("trace", name) {}
+ trace_mark_base (const char* name, const void* data = nullptr)
+ : basic_mark_base ("trace", name, data) {}
};
typedef diag_mark<trace_mark_base> trace_mark;
@@ -290,6 +294,9 @@ namespace build
template <typename E>
struct fail_mark_base
{
+ explicit
+ fail_mark_base (const void* data = nullptr): data_ (data) {}
+
simple_prologue
operator() () const
{
@@ -306,11 +313,15 @@ namespace build
location_prologue
operator() (const L& l) const
{
- return location_prologue (&epilogue, "error", nullptr, get_location (l));
+ return location_prologue (
+ &epilogue, "error", nullptr, get_location (l, data_));
}
static void
epilogue (const diag_record&) {throw E ();}
+
+ private:
+ const void* data_;
};
template <typename E>