cmGeneratorTarget: Trace cmSourceFile objects instead of strings.
This reverses the decision in commit d38423ec
(cmTarget: Add a
method to obtain list of filenames for sources., 2014-03-17). The
cmSourceFile based API is preferred because that avoids creation of
many cmSourceFileLocation objects for matching strings, and the
result is cached by cmTarget.
This commit is contained in:
parent
c5b26f3bec
commit
92e2fbe103
|
@ -606,12 +606,12 @@ private:
|
||||||
cmGlobalGenerator const* GlobalGenerator;
|
cmGlobalGenerator const* GlobalGenerator;
|
||||||
typedef cmGeneratorTarget::SourceEntry SourceEntry;
|
typedef cmGeneratorTarget::SourceEntry SourceEntry;
|
||||||
SourceEntry* CurrentEntry;
|
SourceEntry* CurrentEntry;
|
||||||
std::queue<std::string> SourceQueue;
|
std::queue<cmSourceFile*> SourceQueue;
|
||||||
std::set<std::string> SourcesQueued;
|
std::set<cmSourceFile*> SourcesQueued;
|
||||||
typedef std::map<std::string, cmSourceFile*> NameMapType;
|
typedef std::map<std::string, cmSourceFile*> NameMapType;
|
||||||
NameMapType NameMap;
|
NameMapType NameMap;
|
||||||
|
|
||||||
void QueueSource(std::string const& name);
|
void QueueSource(cmSourceFile* sf);
|
||||||
void FollowName(std::string const& name);
|
void FollowName(std::string const& name);
|
||||||
void FollowNames(std::vector<std::string> const& names);
|
void FollowNames(std::vector<std::string> const& names);
|
||||||
bool IsUtility(std::string const& dep);
|
bool IsUtility(std::string const& dep);
|
||||||
|
@ -642,19 +642,19 @@ cmTargetTraceDependencies
|
||||||
{
|
{
|
||||||
configs.push_back("");
|
configs.push_back("");
|
||||||
}
|
}
|
||||||
std::set<std::string> emitted;
|
std::set<cmSourceFile*> emitted;
|
||||||
for(std::vector<std::string>::const_iterator ci = configs.begin();
|
for(std::vector<std::string>::const_iterator ci = configs.begin();
|
||||||
ci != configs.end(); ++ci)
|
ci != configs.end(); ++ci)
|
||||||
{
|
{
|
||||||
std::vector<std::string> sources;
|
std::vector<cmSourceFile*> sources;
|
||||||
this->Target->GetSourceFiles(sources, *ci);
|
this->Target->GetSourceFiles(sources, *ci);
|
||||||
for(std::vector<std::string>::const_iterator si = sources.begin();
|
for(std::vector<cmSourceFile*>::const_iterator si = sources.begin();
|
||||||
si != sources.end(); ++si)
|
si != sources.end(); ++si)
|
||||||
{
|
{
|
||||||
if(emitted.insert(*si).second && this->SourcesQueued.insert(*si).second)
|
cmSourceFile* sf = *si;
|
||||||
|
if(emitted.insert(sf).second && this->SourcesQueued.insert(sf).second)
|
||||||
{
|
{
|
||||||
this->SourceQueue.push(*si);
|
this->SourceQueue.push(sf);
|
||||||
this->Makefile->GetOrCreateSource(*si);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -673,8 +673,7 @@ void cmTargetTraceDependencies::Trace()
|
||||||
while(!this->SourceQueue.empty())
|
while(!this->SourceQueue.empty())
|
||||||
{
|
{
|
||||||
// Get the next source from the queue.
|
// Get the next source from the queue.
|
||||||
std::string src = this->SourceQueue.front();
|
cmSourceFile* sf = this->SourceQueue.front();
|
||||||
cmSourceFile* sf = this->Makefile->GetSource(src);
|
|
||||||
this->SourceQueue.pop();
|
this->SourceQueue.pop();
|
||||||
this->CurrentEntry = &this->GeneratorTarget->SourceEntries[sf];
|
this->CurrentEntry = &this->GeneratorTarget->SourceEntries[sf];
|
||||||
|
|
||||||
|
@ -702,14 +701,14 @@ void cmTargetTraceDependencies::Trace()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTargetTraceDependencies::QueueSource(std::string const& name)
|
void cmTargetTraceDependencies::QueueSource(cmSourceFile* sf)
|
||||||
{
|
{
|
||||||
if(this->SourcesQueued.insert(name).second)
|
if(this->SourcesQueued.insert(sf).second)
|
||||||
{
|
{
|
||||||
this->SourceQueue.push(name);
|
this->SourceQueue.push(sf);
|
||||||
|
|
||||||
// Make sure this file is in the target.
|
// Make sure this file is in the target.
|
||||||
this->Target->AddSource(name);
|
this->Target->AddSource(sf->GetFullPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,7 +730,7 @@ void cmTargetTraceDependencies::FollowName(std::string const& name)
|
||||||
{
|
{
|
||||||
this->CurrentEntry->Depends.push_back(sf);
|
this->CurrentEntry->Depends.push_back(sf);
|
||||||
}
|
}
|
||||||
this->QueueSource(sf->GetFullPath());
|
this->QueueSource(sf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue