mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-07 16:20:51 +00:00
Add BTs helper to support multiple backtraces
This commit is contained in:
@@ -175,6 +175,32 @@ public:
|
|||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, BT<std::string> const& s);
|
std::ostream& operator<<(std::ostream& os, BT<std::string> const& s);
|
||||||
|
|
||||||
|
// Wrap type T as a value with potentially multiple backtraces. For purposes
|
||||||
|
// of ordering and equality comparison, only the original value is used. The
|
||||||
|
// backtrace is considered incidental.
|
||||||
|
template <typename T>
|
||||||
|
class BTs
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BTs(T v = T(), cmListFileBacktrace bt = cmListFileBacktrace())
|
||||||
|
: Value(std::move(v))
|
||||||
|
{
|
||||||
|
Backtraces.emplace_back(std::move(bt));
|
||||||
|
}
|
||||||
|
T Value;
|
||||||
|
std::vector<cmListFileBacktrace> Backtraces;
|
||||||
|
friend bool operator==(BTs<T> const& l, BTs<T> const& r)
|
||||||
|
{
|
||||||
|
return l.Value == r.Value;
|
||||||
|
}
|
||||||
|
friend bool operator<(BTs<T> const& l, BTs<T> const& r)
|
||||||
|
{
|
||||||
|
return l.Value < r.Value;
|
||||||
|
}
|
||||||
|
friend bool operator==(BTs<T> const& l, T const& r) { return l.Value == r; }
|
||||||
|
friend bool operator==(T const& l, BTs<T> const& r) { return l == r.Value; }
|
||||||
|
};
|
||||||
|
|
||||||
std::vector<BT<std::string>> ExpandListWithBacktrace(
|
std::vector<BT<std::string>> ExpandListWithBacktrace(
|
||||||
std::string const& list,
|
std::string const& list,
|
||||||
cmListFileBacktrace const& bt = cmListFileBacktrace());
|
cmListFileBacktrace const& bt = cmListFileBacktrace());
|
||||||
|
|||||||
Reference in New Issue
Block a user