X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=tools%2Fllvm-config%2Fllvm-config.cpp;h=879b9ab0945ba64235584f2d1e2652bff8bc7c23;hb=872266937b2110656db675f388d5470c53d8862a;hp=30ace56f4cad253d0ee36433e04bc78721661d25;hpb=a6f5a81285bab84212209d47b1238505512c7c87;p=oota-llvm.git diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp index 30ace56f4ca..879b9ab0945 100644 --- a/tools/llvm-config/llvm-config.cpp +++ b/tools/llvm-config/llvm-config.cpp @@ -20,12 +20,12 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" #include "llvm/Config/config.h" #include "llvm/Config/llvm-config.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" -#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -55,7 +55,8 @@ using namespace llvm; static void VisitComponent(StringRef Name, const StringMap &ComponentMap, std::set &VisitedComponents, - std::vector &RequiredLibs) { + std::vector &RequiredLibs, + bool IncludeNonInstalled) { // Lookup the component. AvailableComponent *AC = ComponentMap.lookup(Name); assert(AC && "Invalid component name!"); @@ -66,10 +67,14 @@ static void VisitComponent(StringRef Name, return; } + // Only include non-installed components if requested. + if (!AC->IsInstalled && !IncludeNonInstalled) + return; + // Otherwise, visit all the dependencies. for (unsigned i = 0; AC->RequiredLibraries[i]; ++i) { VisitComponent(AC->RequiredLibraries[i], ComponentMap, VisitedComponents, - RequiredLibs); + RequiredLibs, IncludeNonInstalled); } // Add to the required library list. @@ -84,8 +89,11 @@ static void VisitComponent(StringRef Name, /// \param Components - The names of the components to find libraries for. /// \param RequiredLibs [out] - On return, the ordered list of libraries that /// are required to link the given components. -void ComputeLibsForComponents(const std::vector &Components, - std::vector &RequiredLibs) { +/// \param IncludeNonInstalled - Whether non-installed components should be +/// reported. +static void ComputeLibsForComponents(const std::vector &Components, + std::vector &RequiredLibs, + bool IncludeNonInstalled) { std::set VisitedComponents; // Build a map of component names to information. @@ -108,7 +116,7 @@ void ComputeLibsForComponents(const std::vector &Components, } VisitComponent(ComponentLower, ComponentMap, VisitedComponents, - RequiredLibs); + RequiredLibs, IncludeNonInstalled); } // The list is now ordered with leafs first, we want the libraries to printed @@ -118,7 +126,7 @@ void ComputeLibsForComponents(const std::vector &Components, /* *** */ -void usage() { +static void usage() { errs() << "\ usage: llvm-config