From 907313a9cf3fab2fe348bfebac799c921164b87c Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Fri, 12 Feb 2016 18:43:10 +0000 Subject: [PATCH] llvm-config: replace assertions with a helpful error message From: Mehdi Amini llvm-svn: 260700 --- llvm/tools/llvm-config/llvm-config.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp index a867e1b60d82..e5b121006f5a 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/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.