From 65a42849639a3268f613795683d7c91a6ed8b661 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 18 May 2015 22:05:36 +0200 Subject: cmTarget: Store context in stack only if different. The PushTLLCommandTrace method is called once per link item for a single target_link_libraries command. Avoid storing copies of identical execution contexts and rely on the uniqueness while printing output. --- Source/cmTarget.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ee5f02d..aa556c8 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1240,7 +1240,10 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature) } } cmListFileContext lfc = this->Makefile->GetExecutionContext(); - this->TLLCommands.push_back(std::make_pair(signature, lfc)); + if (this->TLLCommands.empty() || this->TLLCommands.back().second != lfc) + { + this->TLLCommands.push_back(std::make_pair(signature, lfc)); + } return ret; } @@ -1265,18 +1268,12 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s, = (sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain"); s << "The uses of the " << sigString << " signature are here:\n"; - UNORDERED_SET emitted; for(std::vector::iterator it = sigs.begin(); it != sigs.end(); ++it) { cmListFileContext lfc = *it; lfc.FilePath = lg->Convert(lfc.FilePath, cmLocalGenerator::HOME); - std::ostringstream line; - line << " * " << (lfc.Line? "": " in ") << lfc << std::endl; - if (emitted.insert(line.str()).second) - { - s << line.str(); - } + s << " * " << (lfc.Line ? "" : " in ") << lfc << std::endl; } } } -- cgit v0.12