OSDN Git Service

llvm-config: replace assertions with a helpful error message
authorMehdi Amini <mehdi.amini@apple.com>
Fri, 12 Feb 2016 18:43:10 +0000 (18:43 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Fri, 12 Feb 2016 18:43:10 +0000 (18:43 +0000)
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260700 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-config/llvm-config.cpp

index a867e1b..e5b1210 100644 (file)
@@ -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.