cmTarget: Store only cmListFileContext for CMP0023 handling.

Only the top level execution context is shown, as appropriate, so
store only that.
This commit is contained in:
Stephen Kelly 2015-05-18 21:59:18 +02:00
parent 59ba1215b9
commit 52a8d19c9b
2 changed files with 13 additions and 16 deletions

View File

@ -1239,8 +1239,8 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
ret = false; ret = false;
} }
} }
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmListFileContext lfc = this->Makefile->GetExecutionContext();
this->TLLCommands.push_back(std::make_pair(signature, lfbt)); this->TLLCommands.push_back(std::make_pair(signature, lfc));
return ret; return ret;
} }
@ -1248,8 +1248,8 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
void cmTarget::GetTllSignatureTraces(std::ostringstream &s, void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
TLLSignature sig) const TLLSignature sig) const
{ {
std::vector<cmListFileBacktrace> sigs; std::vector<cmListFileContext> sigs;
typedef std::vector<std::pair<TLLSignature, cmListFileBacktrace> > Container; typedef std::vector<std::pair<TLLSignature, cmListFileContext> > Container;
for(Container::const_iterator it = this->TLLCommands.begin(); for(Container::const_iterator it = this->TLLCommands.begin();
it != this->TLLCommands.end(); ++it) it != this->TLLCommands.end(); ++it)
{ {
@ -1258,6 +1258,7 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
sigs.push_back(it->second); sigs.push_back(it->second);
} }
} }
cmLocalGenerator* lg = this->GetMakefile()->GetLocalGenerator();
if (!sigs.empty()) if (!sigs.empty())
{ {
const char *sigString const char *sigString
@ -1265,14 +1266,11 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
: "plain"); : "plain");
s << "The uses of the " << sigString << " signature are here:\n"; s << "The uses of the " << sigString << " signature are here:\n";
UNORDERED_SET<std::string> emitted; UNORDERED_SET<std::string> emitted;
for(std::vector<cmListFileBacktrace>::iterator it = sigs.begin(); for(std::vector<cmListFileContext>::iterator it = sigs.begin();
it != sigs.end(); ++it) it != sigs.end(); ++it)
{ {
it->MakeRelative(); cmListFileContext lfc = *it;
cmListFileBacktrace::const_iterator i = it->begin(); lfc.FilePath = lg->Convert(lfc.FilePath, cmLocalGenerator::HOME);
if(i != it->end())
{
cmListFileContext const& lfc = *i;
std::ostringstream line; std::ostringstream line;
line << " * " << (lfc.Line? "": " in ") << lfc << std::endl; line << " * " << (lfc.Line? "": " in ") << lfc << std::endl;
if (emitted.insert(line.str()).second) if (emitted.insert(line.str()).second)
@ -1282,7 +1280,6 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
} }
} }
} }
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::AddLinkLibrary(cmMakefile& mf, void cmTarget::AddLinkLibrary(cmMakefile& mf,

View File

@ -641,7 +641,7 @@ private:
// directories. // directories.
std::set<std::string> SystemIncludeDirectories; std::set<std::string> SystemIncludeDirectories;
std::vector<std::pair<TLLSignature, cmListFileBacktrace> > TLLCommands; std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands;
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
/** /**