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.
This commit is contained in:
Stephen Kelly 2015-05-18 22:05:36 +02:00
parent 9645cba3bf
commit 65a4284963
1 changed files with 5 additions and 8 deletions

View File

@ -1240,7 +1240,10 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
}
}
cmListFileContext lfc = this->Makefile->GetExecutionContext();
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<std::string> emitted;
for(std::vector<cmListFileContext>::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;
}
}
}