summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-05-23 21:37:39 +0000
committerdim <dim@FreeBSD.org>2012-05-23 21:37:39 +0000
commit2b2816e083a455f7a656ae88b0fd059d1688bb36 (patch)
tree357b13d8e31d55b298d50e9cd5100dc9eb9084b3 /tools
parent982a03fa2c92a09e35903a2bd814666a1e2545a0 (diff)
downloadFreeBSD-src-2b2816e083a455f7a656ae88b0fd059d1688bb36.zip
FreeBSD-src-2b2816e083a455f7a656ae88b0fd059d1688bb36.tar.gz
Vendor import of llvm release_31 r156863 (the actual 3.1 release):
http://llvm.org/svn/llvm-project/llvm/branches/release_31@156863
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-config/llvm-config.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 79fd7f8..126542c 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -54,7 +54,8 @@ using namespace llvm;
static void VisitComponent(StringRef Name,
const StringMap<AvailableComponent*> &ComponentMap,
std::set<AvailableComponent*> &VisitedComponents,
- std::vector<StringRef> &RequiredLibs) {
+ std::vector<StringRef> &RequiredLibs,
+ bool IncludeNonInstalled) {
// Lookup the component.
AvailableComponent *AC = ComponentMap.lookup(Name);
assert(AC && "Invalid component name!");
@@ -65,10 +66,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.
@@ -83,8 +88,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.
+/// \param IncludeNonInstalled - Whether non-installed components should be
+/// reported.
void ComputeLibsForComponents(const std::vector<StringRef> &Components,
- std::vector<StringRef> &RequiredLibs) {
+ std::vector<StringRef> &RequiredLibs,
+ bool IncludeNonInstalled) {
std::set<AvailableComponent*> VisitedComponents;
// Build a map of component names to information.
@@ -107,7 +115,7 @@ void ComputeLibsForComponents(const std::vector<StringRef> &Components,
}
VisitComponent(ComponentLower, ComponentMap, VisitedComponents,
- RequiredLibs);
+ RequiredLibs, IncludeNonInstalled);
}
// The list is now ordered with leafs first, we want the libraries to printed
@@ -278,6 +286,10 @@ int main(int argc, char **argv) {
PrintLibFiles = true;
} else if (Arg == "--components") {
for (unsigned j = 0; j != array_lengthof(AvailableComponents); ++j) {
+ // Only include non-installed components when in a development tree.
+ if (!AvailableComponents[j].IsInstalled && !IsInDevelopmentTree)
+ continue;
+
OS << ' ';
OS << AvailableComponents[j].Name;
}
@@ -310,7 +322,8 @@ int main(int argc, char **argv) {
// Construct the list of all the required libraries.
std::vector<StringRef> RequiredLibs;
- ComputeLibsForComponents(Components, RequiredLibs);
+ ComputeLibsForComponents(Components, RequiredLibs,
+ /*IncludeNonInstalled=*/IsInDevelopmentTree);
for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) {
StringRef Lib = RequiredLibs[i];
OpenPOWER on IntegriCloud