diff options
Diffstat (limited to 'Source/cmListFileCache.cxx')
| -rw-r--r-- | Source/cmListFileCache.cxx | 68 |
1 files changed, 50 insertions, 18 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 3e26349..006ca4c 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -146,18 +146,12 @@ bool cmListFile::ParseFile(const char* filename, } bool parseError = false; - this->ModifiedTime = cmSystemTools::ModifiedTime(filename); { cmListFileParser parser(this, mf, filename); parseError = !parser.ParseFile(); } - if(parseError) - { - this->ModifiedTime = 0; - } - // do we need a cmake_policy(VERSION call? if(topLevel) { @@ -240,8 +234,7 @@ bool cmListFile::ParseFile(const char* filename, { cmListFileFunction project; project.Name = "PROJECT"; - cmListFileArgument prj("Project", cmListFileArgument::Unquoted, - filename, 0); + cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0); project.Arguments.push_back(prj); this->Functions.insert(this->Functions.begin(),project); } @@ -381,7 +374,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line) bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, cmListFileArgument::Delimiter delim) { - cmListFileArgument a(token->text, delim, this->FileName, token->line); + cmListFileArgument a(token->text, delim, token->line); this->Function.Arguments.push_back(a); if(this->Separation == SeparationOkay) { @@ -406,22 +399,42 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, } } -//---------------------------------------------------------------------------- -void cmListFileBacktrace::MakeRelative() +void cmListFileBacktrace::Append(cmListFileContext const& context) +{ + this->push_back(context); +} + +void cmListFileBacktrace::PrintTitle(std::ostream& out) { - if (this->Relative) + if (this->empty()) { return; } - for (cmListFileBacktrace::iterator i = this->begin(); - i != this->end(); ++i) + + cmOutputConverter converter(this->Snapshot); + cmListFileContext lfc = this->front(); + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); + out << (lfc.Line ? " at " : " in ") << lfc; +} + +void cmListFileBacktrace::PrintCallStack(std::ostream& out) +{ + if (size() <= 1) { - i->FilePath = this->LocalGenerator->Convert(i->FilePath, - cmLocalGenerator::HOME); + return; } - this->Relative = true; -} + cmOutputConverter converter(this->Snapshot); + const_iterator i = this->begin() + 1; + out << "Call Stack (most recent call first):\n"; + while(i != this->end()) + { + cmListFileContext lfc = *i; + lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); + out << " " << lfc << "\n"; + ++i; + } +} //---------------------------------------------------------------------------- std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc) @@ -437,3 +450,22 @@ std::ostream& operator<<(std::ostream& os, cmListFileContext const& lfc) } return os; } + +bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs) +{ + if(lhs.Line != rhs.Line) + { + return lhs.Line < rhs.Line; + } + return lhs.FilePath < rhs.FilePath; +} + +bool operator==(const cmListFileContext& lhs, const cmListFileContext& rhs) +{ + return lhs.Line == rhs.Line && lhs.FilePath == rhs.FilePath; +} + +bool operator!=(const cmListFileContext& lhs, const cmListFileContext& rhs) +{ + return !(lhs == rhs); +} |
