[llvm-commits] [llvm] r144291 - /llvm/trunk/tools/llvm-config-2/llvm-config.cpp

Daniel Dunbar daniel at zuster.org
Thu Nov 10 06:53:24 PST 2011


Author: ddunbar
Date: Thu Nov 10 08:53:23 2011
New Revision: 144291

URL: http://llvm.org/viewvc/llvm-project?rev=144291&view=rev
Log:
llvm-config-2: Fix thinko in maintenance of visited component set.

Modified:
    llvm/trunk/tools/llvm-config-2/llvm-config.cpp

Modified: llvm/trunk/tools/llvm-config-2/llvm-config.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config-2/llvm-config.cpp?rev=144291&r1=144290&r2=144291&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config-2/llvm-config.cpp (original)
+++ llvm/trunk/tools/llvm-config-2/llvm-config.cpp Thu Nov 10 08:53:23 2011
@@ -54,18 +54,19 @@
 /// \param RequiredLibs [out] - The ordered list of required libraries.
 static void VisitComponent(StringRef Name,
                            const StringMap<AvailableComponent*> &ComponentMap,
-                           std::set<StringRef> &VisitedComponents,
+                           std::set<AvailableComponent*> &VisitedComponents,
                            std::vector<StringRef> &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 @@
 /// are required to link the given components.
 void ComputeLibsForComponents(const std::vector<StringRef> &Components,
                               std::vector<StringRef> &RequiredLibs) {
-  std::set<StringRef> VisitedComponents;
-  std::vector<StringRef> ToVisit = Components;
+  std::set<AvailableComponent*> VisitedComponents;
 
   // Build a map of component names to information.
   StringMap<AvailableComponent*> ComponentMap;





More information about the llvm-commits mailing list