From 9f3ed029ce830f0395e102258758a4b3680e5d0f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 16 Jun 2014 09:55:20 -0400 Subject: [PATCH] cmTarget: Constify GetTransitivePropertyTargets results Populate a vector of "cmTarget const*" instead of "cmTarget*". --- Source/cmGeneratorExpressionEvaluator.cxx | 11 ++++++----- Source/cmGeneratorTarget.cxx | 10 +++++----- Source/cmTarget.cxx | 4 ++-- Source/cmTarget.h | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index cefdd6316..3dee601cb 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -799,7 +799,8 @@ static const char* targetPropertyTransitiveWhitelist[] = { #undef TRANSITIVE_PROPERTY_NAME -std::string getLinkedTargetsContent(const std::vector &targets, +std::string getLinkedTargetsContent( + const std::vector &targets, cmTarget const* target, cmTarget const* headTarget, cmGeneratorExpressionContext *context, @@ -810,7 +811,7 @@ std::string getLinkedTargetsContent(const std::vector &targets, std::string sep; std::string depString; - for (std::vector::const_iterator + for (std::vector::const_iterator it = targets.begin(); it != targets.end(); ++it) { @@ -847,12 +848,12 @@ std::string getLinkedTargetsContent(const std::vector &libraries, cmGeneratorExpressionDAGChecker *dagChecker, const std::string &interfacePropertyName) { - std::vector tgts; + std::vector tgts; for (std::vector::const_iterator it = libraries.begin(); it != libraries.end(); ++it) { - if (cmTarget *tgt = context->Makefile->FindTargetToUse(*it)) + if (cmTarget const *tgt = context->Makefile->FindTargetToUse(*it)) { tgts.push_back(tgt); } @@ -1082,7 +1083,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmStrCmp(propertyName)) != transEnd) { - std::vector tgts; + std::vector tgts; target->GetTransitivePropertyTargets(context->Config, headTarget, tgts); if (!tgts.empty()) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 381a0ed00..392b37740 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -252,7 +252,7 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const return 0; } -static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, +static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt, const std::string& config, cmTarget *headTarget, cmGeneratorExpressionDAGChecker *dagChecker, @@ -474,11 +474,11 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, &dagChecker), result); } - std::set uniqueDeps; + std::set uniqueDeps; for(std::vector::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { - cmTarget* tgt = this->Makefile->FindTargetToUse(*li); + cmTarget const* tgt = this->Makefile->FindTargetToUse(*li); if (!tgt) { continue; @@ -489,10 +489,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, handleSystemIncludesDep(this->Makefile, tgt, config, this->Target, &dagChecker, result, excludeImported); - std::vector deps; + std::vector deps; tgt->GetTransitivePropertyTargets(config, this->Target, deps); - for(std::vector::const_iterator di = deps.begin(); + for(std::vector::const_iterator di = deps.begin(); di != deps.end(); ++di) { if (uniqueDeps.insert(*di).second) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index cc647af8d..96f28af14 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6197,7 +6197,7 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const //---------------------------------------------------------------------------- void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, - std::vector &tgts) const + std::vector &tgts) const { cmTarget::LinkInterface const* iface = this->GetLinkInterfaceLibraries(config, headTarget); @@ -6212,7 +6212,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, for(std::vector::const_iterator it = iface->Libraries.begin(); it != iface->Libraries.end(); ++it) { - if (cmTarget* tgt = headTarget->GetMakefile() + if (cmTarget const* tgt = headTarget->GetMakefile() ->FindTargetToUse(*it)) { tgts.push_back(tgt); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 07731947c..fae1bbb70 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -271,8 +271,8 @@ public: LinkInterface const* GetLinkInterfaceLibraries(const std::string& config, cmTarget const* headTarget) const; void GetTransitivePropertyTargets(const std::string& config, - cmTarget const* headTarget, - std::vector &libs) const; + cmTarget const* headTarget, + std::vector &libs) const; std::vector const& GetLinkImplementationClosure(const std::string& config) const;