Commit 242dcc2c authored by Stephen Kelly's avatar Stephen Kelly
Browse files

cmListFileBacktrace: Replace local generator with cmState::Snapshot.

Construct cmOutputConverter only when needed.
parent 1cff330b
...@@ -412,9 +412,9 @@ void cmListFileBacktrace::PrintTitle(std::ostream& out) ...@@ -412,9 +412,9 @@ void cmListFileBacktrace::PrintTitle(std::ostream& out)
return; return;
} }
cmOutputConverter converter(this->Snapshot);
cmListFileContext lfc = this->front(); cmListFileContext lfc = this->front();
lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
cmLocalGenerator::HOME);
out << (lfc.Line ? " at " : " in ") << lfc; out << (lfc.Line ? " at " : " in ") << lfc;
} }
...@@ -425,13 +425,13 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out) ...@@ -425,13 +425,13 @@ void cmListFileBacktrace::PrintCallStack(std::ostream& out)
return; return;
} }
cmOutputConverter converter(this->Snapshot);
const_iterator i = this->begin() + 1; const_iterator i = this->begin() + 1;
out << "Call Stack (most recent call first):\n"; out << "Call Stack (most recent call first):\n";
while(i != this->end()) while(i != this->end())
{ {
cmListFileContext lfc = *i; cmListFileContext lfc = *i;
lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
cmLocalGenerator::HOME);
out << " " << lfc << "\n"; out << " " << lfc << "\n";
++i; ++i;
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
class cmLocalGenerator; #include "cmState.h"
/** \class cmListFileCache /** \class cmListFileCache
* \brief A class to cache list file contents. * \brief A class to cache list file contents.
...@@ -74,8 +74,8 @@ struct cmListFileFunction: public cmListFileContext ...@@ -74,8 +74,8 @@ struct cmListFileFunction: public cmListFileContext
class cmListFileBacktrace: private std::vector<cmListFileContext> class cmListFileBacktrace: private std::vector<cmListFileContext>
{ {
public: public:
cmListFileBacktrace(cmLocalGenerator* localGen = 0) cmListFileBacktrace(cmState::Snapshot snapshot = cmState::Snapshot())
: LocalGenerator(localGen) : Snapshot(snapshot)
{ {
} }
...@@ -84,7 +84,7 @@ class cmListFileBacktrace: private std::vector<cmListFileContext> ...@@ -84,7 +84,7 @@ class cmListFileBacktrace: private std::vector<cmListFileContext>
void PrintTitle(std::ostream& out); void PrintTitle(std::ostream& out);
void PrintCallStack(std::ostream& out); void PrintCallStack(std::ostream& out);
private: private:
cmLocalGenerator* LocalGenerator; cmState::Snapshot Snapshot;
}; };
struct cmListFile struct cmListFile
......
...@@ -277,7 +277,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, ...@@ -277,7 +277,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmListFileBacktrace cmMakefile::GetBacktrace() const cmListFileBacktrace cmMakefile::GetBacktrace() const
{ {
cmListFileBacktrace backtrace(this->GetLocalGenerator()); cmListFileBacktrace backtrace(this->StateSnapshot);
for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
i != this->CallStack.rend(); ++i) i != this->CallStack.rend(); ++i)
{ {
...@@ -290,7 +290,7 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const ...@@ -290,7 +290,7 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
cmListFileBacktrace cmListFileBacktrace
cmMakefile::GetBacktrace(cmListFileContext const& lfc) const cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
{ {
cmListFileBacktrace backtrace(this->GetLocalGenerator()); cmListFileBacktrace backtrace(this->StateSnapshot);
backtrace.Append(lfc); backtrace.Append(lfc);
for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin(); for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
i != this->CallStack.rend(); ++i) i != this->CallStack.rend(); ++i)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment