|
@@ -12,6 +12,7 @@
|
|
|
|
|
|
|
|
#include <cm/optional>
|
|
#include <cm/optional>
|
|
|
|
|
|
|
|
|
|
+#include "cmConstStack.h"
|
|
|
#include "cmSystemTools.h"
|
|
#include "cmSystemTools.h"
|
|
|
|
|
|
|
|
/** \class cmListFileCache
|
|
/** \class cmListFileCache
|
|
@@ -157,35 +158,16 @@ bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
|
|
|
bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs);
|
|
bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs);
|
|
|
bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs);
|
|
bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs);
|
|
|
|
|
|
|
|
-// Represent a backtrace (call stack). Provide value semantics
|
|
|
|
|
-// but use efficient reference-counting underneath to avoid copies.
|
|
|
|
|
|
|
+// Represent a backtrace (call stack) with efficient value semantics.
|
|
|
class cmListFileBacktrace
|
|
class cmListFileBacktrace
|
|
|
|
|
+ : public cmConstStack<cmListFileContext, cmListFileBacktrace>
|
|
|
{
|
|
{
|
|
|
-public:
|
|
|
|
|
- // Default-constructed backtrace is empty.
|
|
|
|
|
- cmListFileBacktrace() = default;
|
|
|
|
|
-
|
|
|
|
|
- // Get a backtrace with the given call context added to the top.
|
|
|
|
|
- cmListFileBacktrace Push(cmListFileContext const& lfc) const;
|
|
|
|
|
-
|
|
|
|
|
- // Get a backtrace with the top level removed.
|
|
|
|
|
- // May not be called until after a matching Push.
|
|
|
|
|
- cmListFileBacktrace Pop() const;
|
|
|
|
|
-
|
|
|
|
|
- // Get the context at the top of the backtrace.
|
|
|
|
|
- // This may be called only if Empty() would return false.
|
|
|
|
|
- cmListFileContext const& Top() const;
|
|
|
|
|
-
|
|
|
|
|
- // Return true if this backtrace is empty.
|
|
|
|
|
- bool Empty() const;
|
|
|
|
|
-
|
|
|
|
|
-private:
|
|
|
|
|
- struct Entry;
|
|
|
|
|
- std::shared_ptr<Entry const> TopEntry;
|
|
|
|
|
- cmListFileBacktrace(std::shared_ptr<Entry const> parent,
|
|
|
|
|
- cmListFileContext const& lfc);
|
|
|
|
|
- cmListFileBacktrace(std::shared_ptr<Entry const> top);
|
|
|
|
|
|
|
+ using cmConstStack::cmConstStack;
|
|
|
|
|
+ friend class cmConstStack<cmListFileContext, cmListFileBacktrace>;
|
|
|
};
|
|
};
|
|
|
|
|
+#ifndef cmListFileCache_cxx
|
|
|
|
|
+extern template class cmConstStack<cmListFileContext, cmListFileBacktrace>;
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
// Wrap type T as a value with a backtrace. For purposes of
|
|
// Wrap type T as a value with a backtrace. For purposes of
|
|
|
// ordering and equality comparison, only the original value is
|
|
// ordering and equality comparison, only the original value is
|