diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 14:34:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 20:05:19 (GMT) |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Source/cmComputeTargetDepends.cxx | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | CMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2 |
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Diffstat (limited to 'Source/cmComputeTargetDepends.cxx')
-rw-r--r-- | Source/cmComputeTargetDepends.cxx | 442 |
1 files changed, 182 insertions, 260 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 1b5297f..570405a 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -98,10 +98,10 @@ cmComputeTargetDepends::cmComputeTargetDepends(cmGlobalGenerator* gg) { this->GlobalGenerator = gg; cmake* cm = this->GlobalGenerator->GetCMakeInstance(); - this->DebugMode = cm->GetState() - ->GetGlobalPropertyAsBool("GLOBAL_DEPENDS_DEBUG_MODE"); - this->NoCycles = cm->GetState() - ->GetGlobalPropertyAsBool("GLOBAL_DEPENDS_NO_CYCLES"); + this->DebugMode = + cm->GetState()->GetGlobalPropertyAsBool("GLOBAL_DEPENDS_DEBUG_MODE"); + this->NoCycles = + cm->GetState()->GetGlobalPropertyAsBool("GLOBAL_DEPENDS_NO_CYCLES"); } cmComputeTargetDepends::~cmComputeTargetDepends() @@ -113,54 +113,47 @@ bool cmComputeTargetDepends::Compute() // Build the original graph. this->CollectTargets(); this->CollectDepends(); - if(this->DebugMode) - { + if (this->DebugMode) { this->DisplayGraph(this->InitialGraph, "initial"); - } + } // Identify components. cmComputeComponentGraph ccg(this->InitialGraph); - if(this->DebugMode) - { + if (this->DebugMode) { this->DisplayComponents(ccg); - } - if(!this->CheckComponents(ccg)) - { + } + if (!this->CheckComponents(ccg)) { return false; - } + } // Compute the final dependency graph. - if(!this->ComputeFinalDepends(ccg)) - { + if (!this->ComputeFinalDepends(ccg)) { return false; - } - if(this->DebugMode) - { + } + if (this->DebugMode) { this->DisplayGraph(this->FinalGraph, "final"); - } + } return true; } -void -cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t, - cmTargetDependSet& deps) +void cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t, + cmTargetDependSet& deps) { // Lookup the index for this target. All targets should be known by // this point. - std::map<cmGeneratorTarget const*, int>::const_iterator tii - = this->TargetIndex.find(t); + std::map<cmGeneratorTarget const*, int>::const_iterator tii = + this->TargetIndex.find(t); assert(tii != this->TargetIndex.end()); int i = tii->second; // Get its final dependencies. EdgeList const& nl = this->FinalGraph[i]; - for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) - { + for (EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { cmGeneratorTarget const* dep = this->Targets[*ni]; cmTargetDependSet::iterator di = deps.insert(dep).first; di->SetType(ni->IsStrong()); - } + } } void cmComputeTargetDepends::CollectTargets() @@ -168,19 +161,17 @@ void cmComputeTargetDepends::CollectTargets() // Collect all targets from all generators. std::vector<cmLocalGenerator*> const& lgens = this->GlobalGenerator->GetLocalGenerators(); - for(unsigned int i = 0; i < lgens.size(); ++i) - { + for (unsigned int i = 0; i < lgens.size(); ++i) { const std::vector<cmGeneratorTarget*> targets = - lgens[i]->GetGeneratorTargets(); - for(std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); - ti != targets.end(); ++ti) - { + lgens[i]->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); + ti != targets.end(); ++ti) { cmGeneratorTarget* gt = *ti; int index = static_cast<int>(this->Targets.size()); this->TargetIndex[gt] = index; this->Targets.push_back(gt); - } } + } } void cmComputeTargetDepends::CollectDepends() @@ -189,74 +180,66 @@ void cmComputeTargetDepends::CollectDepends() this->InitialGraph.resize(this->Targets.size()); // Compute each dependency list. - for(unsigned int i=0; i < this->Targets.size(); ++i) - { + for (unsigned int i = 0; i < this->Targets.size(); ++i) { this->CollectTargetDepends(i); - } + } } void cmComputeTargetDepends::CollectTargetDepends(int depender_index) { // Get the depender. cmGeneratorTarget const* depender = this->Targets[depender_index]; - if (depender->GetType() == cmState::INTERFACE_LIBRARY) - { + if (depender->GetType() == cmState::INTERFACE_LIBRARY) { return; - } + } // Loop over all targets linked directly in all configs. // We need to make targets depend on the union of all config-specific // dependencies in all targets, because the generated build-systems can't // deal with config-specific dependencies. { - std::set<std::string> emitted; + std::set<std::string> emitted; - std::vector<std::string> configs; - depender->Makefile->GetConfigurations(configs); - if (configs.empty()) - { - configs.push_back(""); + std::vector<std::string> configs; + depender->Makefile->GetConfigurations(configs); + if (configs.empty()) { + configs.push_back(""); } - for (std::vector<std::string>::const_iterator it = configs.begin(); - it != configs.end(); ++it) - { - std::vector<cmSourceFile const*> objectFiles; - depender->GetExternalObjects(objectFiles, *it); - for(std::vector<cmSourceFile const*>::const_iterator - oi = objectFiles.begin(); oi != objectFiles.end(); ++oi) - { - std::string objLib = (*oi)->GetObjectLibrary(); - if (!objLib.empty() && emitted.insert(objLib).second) - { - if(depender->GetType() != cmState::EXECUTABLE && - depender->GetType() != cmState::STATIC_LIBRARY && - depender->GetType() != cmState::SHARED_LIBRARY && - depender->GetType() != cmState::MODULE_LIBRARY) - { - this->GlobalGenerator->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, - "Only executables and non-OBJECT libraries may " - "reference target objects.", - depender->GetBacktrace()); - return; + for (std::vector<std::string>::const_iterator it = configs.begin(); + it != configs.end(); ++it) { + std::vector<cmSourceFile const*> objectFiles; + depender->GetExternalObjects(objectFiles, *it); + for (std::vector<cmSourceFile const*>::const_iterator oi = + objectFiles.begin(); + oi != objectFiles.end(); ++oi) { + std::string objLib = (*oi)->GetObjectLibrary(); + if (!objLib.empty() && emitted.insert(objLib).second) { + if (depender->GetType() != cmState::EXECUTABLE && + depender->GetType() != cmState::STATIC_LIBRARY && + depender->GetType() != cmState::SHARED_LIBRARY && + depender->GetType() != cmState::MODULE_LIBRARY) { + this->GlobalGenerator->GetCMakeInstance()->IssueMessage( + cmake::FATAL_ERROR, + "Only executables and non-OBJECT libraries may " + "reference target objects.", + depender->GetBacktrace()); + return; } - const_cast<cmGeneratorTarget*>(depender)->Target->AddUtility(objLib); + const_cast<cmGeneratorTarget*>(depender)->Target->AddUtility(objLib); } } - cmLinkImplementation const* impl = depender->GetLinkImplementation(*it); + cmLinkImplementation const* impl = depender->GetLinkImplementation(*it); - // A target should not depend on itself. - emitted.insert(depender->GetName()); - for(std::vector<cmLinkImplItem>::const_iterator - lib = impl->Libraries.begin(); - lib != impl->Libraries.end(); ++lib) - { - // Don't emit the same library twice for this target. - if(emitted.insert(*lib).second) - { - this->AddTargetDepend(depender_index, *lib, true); - this->AddInterfaceDepends(depender_index, *lib, emitted); + // A target should not depend on itself. + emitted.insert(depender->GetName()); + for (std::vector<cmLinkImplItem>::const_iterator lib = + impl->Libraries.begin(); + lib != impl->Libraries.end(); ++lib) { + // Don't emit the same library twice for this target. + if (emitted.insert(*lib).second) { + this->AddTargetDepend(depender_index, *lib, true); + this->AddInterfaceDepends(depender_index, *lib, emitted); } } } @@ -264,80 +247,69 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Loop over all utility dependencies. { - std::set<cmLinkItem> const& tutils = depender->GetUtilityItems(); - std::set<std::string> emitted; - // A target should not depend on itself. - emitted.insert(depender->GetName()); - for(std::set<cmLinkItem>::const_iterator util = tutils.begin(); - util != tutils.end(); ++util) - { - // Don't emit the same utility twice for this target. - if(emitted.insert(*util).second) - { - this->AddTargetDepend(depender_index, *util, false); + std::set<cmLinkItem> const& tutils = depender->GetUtilityItems(); + std::set<std::string> emitted; + // A target should not depend on itself. + emitted.insert(depender->GetName()); + for (std::set<cmLinkItem>::const_iterator util = tutils.begin(); + util != tutils.end(); ++util) { + // Don't emit the same utility twice for this target. + if (emitted.insert(*util).second) { + this->AddTargetDepend(depender_index, *util, false); } } } } -void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, - const cmGeneratorTarget* dependee, - const std::string& config, - std::set<std::string> &emitted) +void cmComputeTargetDepends::AddInterfaceDepends( + int depender_index, const cmGeneratorTarget* dependee, + const std::string& config, std::set<std::string>& emitted) { cmGeneratorTarget const* depender = this->Targets[depender_index]; - if(cmLinkInterface const* iface = - dependee->GetLinkInterface(config, - depender)) - { - for(std::vector<cmLinkItem>::const_iterator - lib = iface->Libraries.begin(); - lib != iface->Libraries.end(); ++lib) - { + if (cmLinkInterface const* iface = + dependee->GetLinkInterface(config, depender)) { + for (std::vector<cmLinkItem>::const_iterator lib = + iface->Libraries.begin(); + lib != iface->Libraries.end(); ++lib) { // Don't emit the same library twice for this target. - if(emitted.insert(*lib).second) - { + if (emitted.insert(*lib).second) { this->AddTargetDepend(depender_index, *lib, true); this->AddInterfaceDepends(depender_index, *lib, emitted); - } } } + } } -void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, - cmLinkItem const& dependee_name, - std::set<std::string> &emitted) +void cmComputeTargetDepends::AddInterfaceDepends( + int depender_index, cmLinkItem const& dependee_name, + std::set<std::string>& emitted) { cmGeneratorTarget const* depender = this->Targets[depender_index]; cmGeneratorTarget const* dependee = dependee_name.Target; // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable // within the project. - if(dependee && - dependee->GetType() == cmState::EXECUTABLE && - !dependee->IsExecutableWithExports()) - { + if (dependee && dependee->GetType() == cmState::EXECUTABLE && + !dependee->IsExecutableWithExports()) { dependee = 0; - } + } - if(dependee) - { + if (dependee) { this->AddInterfaceDepends(depender_index, dependee, "", emitted); std::vector<std::string> configs; depender->Makefile->GetConfigurations(configs); for (std::vector<std::string>::const_iterator it = configs.begin(); - it != configs.end(); ++it) - { + it != configs.end(); ++it) { // A target should not depend on itself. emitted.insert(depender->GetName()); this->AddInterfaceDepends(depender_index, dependee, *it, emitted); - } } + } } -void cmComputeTargetDepends::AddTargetDepend( - int depender_index, cmLinkItem const& dependee_name, - bool linking) +void cmComputeTargetDepends::AddTargetDepend(int depender_index, + cmLinkItem const& dependee_name, + bool linking) { // Get the depender. cmGeneratorTarget const* depender = this->Targets[depender_index]; @@ -345,14 +317,12 @@ void cmComputeTargetDepends::AddTargetDepend( // Check the target's makefile first. cmGeneratorTarget const* dependee = dependee_name.Target; - if(!dependee && !linking && - (depender->GetType() != cmState::GLOBAL_TARGET)) - { + if (!dependee && !linking && + (depender->GetType() != cmState::GLOBAL_TARGET)) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; std::ostringstream e; - switch(depender->GetPolicyStatusCMP0046()) - { + switch (depender->GetPolicyStatusCMP0046()) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n"; issueMessage = true; @@ -363,65 +333,52 @@ void cmComputeTargetDepends::AddTargetDepend( case cmPolicies::REQUIRED_ALWAYS: issueMessage = true; messageType = cmake::FATAL_ERROR; - } - if(issueMessage) - { + } + if (issueMessage) { cmake* cm = this->GlobalGenerator->GetCMakeInstance(); - e << "The dependency target \"" << dependee_name - << "\" of target \"" << depender->GetName() << "\" does not exist."; + e << "The dependency target \"" << dependee_name << "\" of target \"" + << depender->GetName() << "\" does not exist."; cmListFileBacktrace const* backtrace = depender->GetUtilityBacktrace(dependee_name); - if(backtrace) - { + if (backtrace) { cm->IssueMessage(messageType, e.str(), *backtrace); - } - else - { + } else { cm->IssueMessage(messageType, e.str()); - } - } } + } // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable // within the project. - if(linking && dependee && - dependee->GetType() == cmState::EXECUTABLE && - !dependee->IsExecutableWithExports()) - { + if (linking && dependee && dependee->GetType() == cmState::EXECUTABLE && + !dependee->IsExecutableWithExports()) { dependee = 0; - } + } - if(dependee) - { + if (dependee) { this->AddTargetDepend(depender_index, dependee, linking); - } + } } void cmComputeTargetDepends::AddTargetDepend(int depender_index, const cmGeneratorTarget* dependee, bool linking) { - if(dependee->IsImported() || - dependee->GetType() == cmState::INTERFACE_LIBRARY) - { + if (dependee->IsImported() || + dependee->GetType() == cmState::INTERFACE_LIBRARY) { // Skip IMPORTED and INTERFACE targets but follow their utility // dependencies. std::set<cmLinkItem> const& utils = dependee->GetUtilityItems(); - for(std::set<cmLinkItem>::const_iterator i = utils.begin(); - i != utils.end(); ++i) - { - if(cmGeneratorTarget const* transitive_dependee = i->Target) - { + for (std::set<cmLinkItem>::const_iterator i = utils.begin(); + i != utils.end(); ++i) { + if (cmGeneratorTarget const* transitive_dependee = i->Target) { this->AddTargetDepend(depender_index, transitive_dependee, false); - } } } - else - { + } else { // Lookup the index for this target. All targets should be known by // this point. std::map<cmGeneratorTarget const*, int>::const_iterator tii = @@ -432,96 +389,82 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, // Add this entry to the dependency graph. this->InitialGraph[depender_index].push_back( cmGraphEdge(dependee_index, !linking)); - } + } } -void -cmComputeTargetDepends::DisplayGraph(Graph const& graph, - const std::string& name) +void cmComputeTargetDepends::DisplayGraph(Graph const& graph, + const std::string& name) { fprintf(stderr, "The %s target dependency graph is:\n", name.c_str()); int n = static_cast<int>(graph.size()); - for(int depender_index = 0; depender_index < n; ++depender_index) - { + for (int depender_index = 0; depender_index < n; ++depender_index) { EdgeList const& nl = graph[depender_index]; cmGeneratorTarget const* depender = this->Targets[depender_index]; - fprintf(stderr, "target %d is [%s]\n", - depender_index, depender->GetName().c_str()); - for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) - { + fprintf(stderr, "target %d is [%s]\n", depender_index, + depender->GetName().c_str()); + for (EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { int dependee_index = *ni; cmGeneratorTarget const* dependee = this->Targets[dependee_index]; fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index, - dependee->GetName().c_str(), ni->IsStrong()? "strong" : "weak"); - } + dependee->GetName().c_str(), ni->IsStrong() ? "strong" : "weak"); } + } fprintf(stderr, "\n"); } -void -cmComputeTargetDepends -::DisplayComponents(cmComputeComponentGraph const& ccg) +void cmComputeTargetDepends::DisplayComponents( + cmComputeComponentGraph const& ccg) { fprintf(stderr, "The strongly connected components are:\n"); std::vector<NodeList> const& components = ccg.GetComponents(); int n = static_cast<int>(components.size()); - for(int c = 0; c < n; ++c) - { + for (int c = 0; c < n; ++c) { NodeList const& nl = components[c]; fprintf(stderr, "Component (%d):\n", c); - for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) - { + for (NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { int i = *ni; - fprintf(stderr, " contains target %d [%s]\n", - i, this->Targets[i]->GetName().c_str()); - } + fprintf(stderr, " contains target %d [%s]\n", i, + this->Targets[i]->GetName().c_str()); } + } fprintf(stderr, "\n"); } -bool -cmComputeTargetDepends -::CheckComponents(cmComputeComponentGraph const& ccg) +bool cmComputeTargetDepends::CheckComponents( + cmComputeComponentGraph const& ccg) { // All non-trivial components should consist only of static // libraries. std::vector<NodeList> const& components = ccg.GetComponents(); int nc = static_cast<int>(components.size()); - for(int c=0; c < nc; ++c) - { + for (int c = 0; c < nc; ++c) { // Get the current component. NodeList const& nl = components[c]; // Skip trivial components. - if(nl.size() < 2) - { + if (nl.size() < 2) { continue; - } + } // Immediately complain if no cycles are allowed at all. - if(this->NoCycles) - { + if (this->NoCycles) { this->ComplainAboutBadComponent(ccg, c); return false; - } + } // Make sure the component is all STATIC_LIBRARY targets. - for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) - { - if(this->Targets[*ni]->GetType() != cmState::STATIC_LIBRARY) - { + for (NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { + if (this->Targets[*ni]->GetType() != cmState::STATIC_LIBRARY) { this->ComplainAboutBadComponent(ccg, c); return false; - } } } + } return true; } -void -cmComputeTargetDepends -::ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, int c, - bool strong) +void cmComputeTargetDepends::ComplainAboutBadComponent( + cmComputeComponentGraph const& ccg, int c, bool strong) { // Construct the error message. std::ostringstream e; @@ -530,8 +473,7 @@ cmComputeTargetDepends std::vector<NodeList> const& components = ccg.GetComponents(); std::vector<int> const& cmap = ccg.GetComponentMap(); NodeList const& cl = components[c]; - for(NodeList::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) - { + for (NodeList::const_iterator ci = cl.begin(); ci != cl.end(); ++ci) { // Get the depender. int i = *ci; cmGeneratorTarget const* depender = this->Targets[i]; @@ -542,82 +484,66 @@ cmComputeTargetDepends // List its dependencies that are inside the component. EdgeList const& nl = this->InitialGraph[i]; - for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) - { + for (EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { int j = *ni; - if(cmap[j] == c) - { + if (cmap[j] == c) { cmGeneratorTarget const* dependee = this->Targets[j]; e << " depends on \"" << dependee->GetName() << "\"" - << " (" << (ni->IsStrong()? "strong" : "weak") << ")\n"; - } + << " (" << (ni->IsStrong() ? "strong" : "weak") << ")\n"; } } - if(strong) - { + } + if (strong) { // Custom command executable dependencies cannot occur within a // component of static libraries. The cycle must appear in calls // to add_dependencies. e << "The component contains at least one cycle consisting of strong " << "dependencies (created by add_dependencies) that cannot be broken."; - } - else if(this->NoCycles) - { + } else if (this->NoCycles) { e << "The GLOBAL_DEPENDS_NO_CYCLES global property is enabled, so " << "cyclic dependencies are not allowed even among static libraries."; - } - else - { + } else { e << "At least one of these targets is not a STATIC_LIBRARY. " << "Cyclic dependencies are allowed only among static libraries."; - } + } cmSystemTools::Error(e.str().c_str()); } -bool -cmComputeTargetDepends -::IntraComponent(std::vector<int> const& cmap, int c, int i, int* head, - std::set<int>& emitted, std::set<int>& visited) +bool cmComputeTargetDepends::IntraComponent(std::vector<int> const& cmap, + int c, int i, int* head, + std::set<int>& emitted, + std::set<int>& visited) { - if(!visited.insert(i).second) - { + if (!visited.insert(i).second) { // Cycle in utility depends! return false; - } - if(emitted.insert(i).second) - { + } + if (emitted.insert(i).second) { // Honor strong intra-component edges in the final order. EdgeList const& el = this->InitialGraph[i]; - for(EdgeList::const_iterator ei = el.begin(); ei != el.end(); ++ei) - { + for (EdgeList::const_iterator ei = el.begin(); ei != el.end(); ++ei) { int j = *ei; - if(cmap[j] == c && ei->IsStrong()) - { + if (cmap[j] == c && ei->IsStrong()) { this->FinalGraph[i].push_back(cmGraphEdge(j, true)); - if(!this->IntraComponent(cmap, c, j, head, emitted, visited)) - { + if (!this->IntraComponent(cmap, c, j, head, emitted, visited)) { return false; - } } } + } // Prepend to a linear linked-list of intra-component edges. - if(*head >= 0) - { + if (*head >= 0) { this->FinalGraph[i].push_back(cmGraphEdge(*head, false)); - } - else - { + } else { this->ComponentTail[c] = i; - } - *head = i; } + *head = i; + } return true; } -bool -cmComputeTargetDepends -::ComputeFinalDepends(cmComputeComponentGraph const& ccg) +bool cmComputeTargetDepends::ComputeFinalDepends( + cmComputeComponentGraph const& ccg) { // Get the component graph information. std::vector<NodeList> const& components = ccg.GetComponents(); @@ -632,38 +558,34 @@ cmComputeTargetDepends this->ComponentHead.resize(components.size()); this->ComponentTail.resize(components.size()); int nc = static_cast<int>(components.size()); - for(int c=0; c < nc; ++c) - { + for (int c = 0; c < nc; ++c) { int head = -1; std::set<int> emitted; NodeList const& nl = components[c]; - for(NodeList::const_reverse_iterator ni = nl.rbegin(); - ni != nl.rend(); ++ni) - { + for (NodeList::const_reverse_iterator ni = nl.rbegin(); ni != nl.rend(); + ++ni) { std::set<int> visited; - if(!this->IntraComponent(cmap, c, *ni, &head, emitted, visited)) - { + if (!this->IntraComponent(cmap, c, *ni, &head, emitted, visited)) { // Cycle in add_dependencies within component! this->ComplainAboutBadComponent(ccg, c, true); return false; - } } - this->ComponentHead[c] = head; } + this->ComponentHead[c] = head; + } // Convert inter-component edges to connect component tails to heads. int n = static_cast<int>(cgraph.size()); - for(int depender_component=0; depender_component < n; ++depender_component) - { + for (int depender_component = 0; depender_component < n; + ++depender_component) { int depender_component_tail = this->ComponentTail[depender_component]; EdgeList const& nl = cgraph[depender_component]; - for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) - { + for (EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { int dependee_component = *ni; int dependee_component_head = this->ComponentHead[dependee_component]; - this->FinalGraph[depender_component_tail] - .push_back(cmGraphEdge(dependee_component_head, ni->IsStrong())); - } + this->FinalGraph[depender_component_tail].push_back( + cmGraphEdge(dependee_component_head, ni->IsStrong())); } + } return true; } |