[llvm] r260700 - llvm-config: replace assertions with a helpful error message

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 10:43:10 PST 2016


Author: mehdi_amini
Date: Fri Feb 12 12:43:10 2016
New Revision: 260700

URL: http://llvm.org/viewvc/llvm-project?rev=260700&view=rev
Log:
llvm-config: replace assertions with a helpful error message

From: Mehdi Amini <mehdi.amini at apple.com>

Modified:
    llvm/trunk/tools/llvm-config/llvm-config.cpp

Modified: llvm/trunk/tools/llvm-config/llvm-config.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/llvm-config.cpp?rev=260700&r1=260699&r2=260700&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/llvm-config.cpp (original)
+++ llvm/trunk/tools/llvm-config/llvm-config.cpp Fri Feb 12 12:43:10 2016
@@ -83,6 +83,14 @@ static void VisitComponent(const std::st
                            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.




More information about the llvm-commits mailing list