summaryrefslogtreecommitdiff
path: root/tools/llvm-config
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-02-12 18:43:10 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-02-12 18:43:10 +0000
commit1b8de27709c74fa127051672d4f74313f0de0206 (patch)
tree4518e79c3299d379921abc06090f94be0c8331c4 /tools/llvm-config
parentd832030acefea868181826681558030bf995ce86 (diff)
llvm-config: replace assertions with a helpful error message
From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-config')
-rw-r--r--tools/llvm-config/llvm-config.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index a867e1b60d8..e5b121006f5 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -83,6 +83,14 @@ static void VisitComponent(const std::string &Name,
const std::string &DirSep) {
// Lookup the component.
AvailableComponent *AC = ComponentMap.lookup(Name);
+ if (!AC) {
+ errs() << "Can't find component: '" << Name << "' in the map. Available components are: ";
+ for (const auto &Component : ComponentMap) {
+ errs() << "'" << Component.first() << "' ";
+ }
+ errs() << "\n";
+ report_fatal_error("abort");
+ }
assert(AC && "Invalid component name!");
// Add to the visited table.