cmTarget: Constify GetTransitivePropertyTargets results

Populate a vector of "cmTarget const*" instead of "cmTarget*".
This commit is contained in:
Brad King 2014-06-16 09:55:20 -04:00
parent 6f0951af01
commit 9f3ed029ce
4 changed files with 15 additions and 14 deletions

View File

@ -799,7 +799,8 @@ static const char* targetPropertyTransitiveWhitelist[] = {
#undef TRANSITIVE_PROPERTY_NAME #undef TRANSITIVE_PROPERTY_NAME
std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets, std::string getLinkedTargetsContent(
const std::vector<cmTarget const*> &targets,
cmTarget const* target, cmTarget const* target,
cmTarget const* headTarget, cmTarget const* headTarget,
cmGeneratorExpressionContext *context, cmGeneratorExpressionContext *context,
@ -810,7 +811,7 @@ std::string getLinkedTargetsContent(const std::vector<cmTarget*> &targets,
std::string sep; std::string sep;
std::string depString; std::string depString;
for (std::vector<cmTarget*>::const_iterator for (std::vector<cmTarget const*>::const_iterator
it = targets.begin(); it = targets.begin();
it != targets.end(); ++it) it != targets.end(); ++it)
{ {
@ -847,12 +848,12 @@ std::string getLinkedTargetsContent(const std::vector<std::string> &libraries,
cmGeneratorExpressionDAGChecker *dagChecker, cmGeneratorExpressionDAGChecker *dagChecker,
const std::string &interfacePropertyName) const std::string &interfacePropertyName)
{ {
std::vector<cmTarget*> tgts; std::vector<cmTarget const*> tgts;
for (std::vector<std::string>::const_iterator for (std::vector<std::string>::const_iterator
it = libraries.begin(); it = libraries.begin();
it != libraries.end(); ++it) it != libraries.end(); ++it)
{ {
if (cmTarget *tgt = context->Makefile->FindTargetToUse(*it)) if (cmTarget const *tgt = context->Makefile->FindTargetToUse(*it))
{ {
tgts.push_back(tgt); tgts.push_back(tgt);
} }
@ -1082,7 +1083,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
cmStrCmp(propertyName)) != transEnd) cmStrCmp(propertyName)) != transEnd)
{ {
std::vector<cmTarget*> tgts; std::vector<cmTarget const*> tgts;
target->GetTransitivePropertyTargets(context->Config, target->GetTransitivePropertyTargets(context->Config,
headTarget, tgts); headTarget, tgts);
if (!tgts.empty()) if (!tgts.empty())

View File

@ -252,7 +252,7 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const
return 0; return 0;
} }
static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt,
const std::string& config, const std::string& config,
cmTarget *headTarget, cmTarget *headTarget,
cmGeneratorExpressionDAGChecker *dagChecker, cmGeneratorExpressionDAGChecker *dagChecker,
@ -474,11 +474,11 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
&dagChecker), result); &dagChecker), result);
} }
std::set<cmTarget*> uniqueDeps; std::set<cmTarget const*> uniqueDeps;
for(std::vector<std::string>::const_iterator li = impl->Libraries.begin(); for(std::vector<std::string>::const_iterator li = impl->Libraries.begin();
li != impl->Libraries.end(); ++li) li != impl->Libraries.end(); ++li)
{ {
cmTarget* tgt = this->Makefile->FindTargetToUse(*li); cmTarget const* tgt = this->Makefile->FindTargetToUse(*li);
if (!tgt) if (!tgt)
{ {
continue; continue;
@ -489,10 +489,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
handleSystemIncludesDep(this->Makefile, tgt, config, this->Target, handleSystemIncludesDep(this->Makefile, tgt, config, this->Target,
&dagChecker, result, excludeImported); &dagChecker, result, excludeImported);
std::vector<cmTarget*> deps; std::vector<cmTarget const*> deps;
tgt->GetTransitivePropertyTargets(config, this->Target, deps); tgt->GetTransitivePropertyTargets(config, this->Target, deps);
for(std::vector<cmTarget*>::const_iterator di = deps.begin(); for(std::vector<cmTarget const*>::const_iterator di = deps.begin();
di != deps.end(); ++di) di != deps.end(); ++di)
{ {
if (uniqueDeps.insert(*di).second) if (uniqueDeps.insert(*di).second)

View File

@ -6197,7 +6197,7 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::GetTransitivePropertyTargets(const std::string& config, void cmTarget::GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget, cmTarget const* headTarget,
std::vector<cmTarget*> &tgts) const std::vector<cmTarget const*> &tgts) const
{ {
cmTarget::LinkInterface const* iface cmTarget::LinkInterface const* iface
= this->GetLinkInterfaceLibraries(config, headTarget); = this->GetLinkInterfaceLibraries(config, headTarget);
@ -6212,7 +6212,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
for(std::vector<std::string>::const_iterator it = iface->Libraries.begin(); for(std::vector<std::string>::const_iterator it = iface->Libraries.begin();
it != iface->Libraries.end(); ++it) it != iface->Libraries.end(); ++it)
{ {
if (cmTarget* tgt = headTarget->GetMakefile() if (cmTarget const* tgt = headTarget->GetMakefile()
->FindTargetToUse(*it)) ->FindTargetToUse(*it))
{ {
tgts.push_back(tgt); tgts.push_back(tgt);

View File

@ -271,8 +271,8 @@ public:
LinkInterface const* GetLinkInterfaceLibraries(const std::string& config, LinkInterface const* GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* headTarget) const; cmTarget const* headTarget) const;
void GetTransitivePropertyTargets(const std::string& config, void GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget, cmTarget const* headTarget,
std::vector<cmTarget*> &libs) const; std::vector<cmTarget const*> &libs) const;
std::vector<cmTarget*> const& std::vector<cmTarget*> const&
GetLinkImplementationClosure(const std::string& config) const; GetLinkImplementationClosure(const std::string& config) const;