From 45b3cafb6a75189b930f25a6edbebe0bce935cdb Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 10 Nov 2011 14:53:23 +0000 Subject: [PATCH] llvm-config-2: Fix thinko in maintenance of visited component set. llvm-svn: 144291 --- tools/llvm-config-2/llvm-config.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/llvm-config-2/llvm-config.cpp b/tools/llvm-config-2/llvm-config.cpp index ec0daad0356..30ace56f4ca 100644 --- a/tools/llvm-config-2/llvm-config.cpp +++ b/tools/llvm-config-2/llvm-config.cpp @@ -54,18 +54,19 @@ using namespace llvm; /// \param RequiredLibs [out] - The ordered list of required libraries. static void VisitComponent(StringRef Name, const StringMap &ComponentMap, - std::set &VisitedComponents, + std::set &VisitedComponents, std::vector &RequiredLibs) { + // Lookup the component. + AvailableComponent *AC = ComponentMap.lookup(Name); + assert(AC && "Invalid component name!"); + // Add to the visited table. - if (!VisitedComponents.insert(Name).second) { + if (!VisitedComponents.insert(AC).second) { // We are done if the component has already been visited. return; } // Otherwise, visit all the dependencies. - AvailableComponent *AC = ComponentMap.lookup(Name); - assert(AC && "Invalid component name!"); - for (unsigned i = 0; AC->RequiredLibraries[i]; ++i) { VisitComponent(AC->RequiredLibraries[i], ComponentMap, VisitedComponents, RequiredLibs); @@ -85,8 +86,7 @@ static void VisitComponent(StringRef Name, /// are required to link the given components. void ComputeLibsForComponents(const std::vector &Components, std::vector &RequiredLibs) { - std::set VisitedComponents; - std::vector ToVisit = Components; + std::set VisitedComponents; // Build a map of component names to information. StringMap ComponentMap;