[cfe-commits] r44552 - /cfe/trunk/Driver/clang.cpp

Ted Kremenek kremenek at apple.com
Mon Dec 3 14:11:32 PST 2007


Author: kremenek
Date: Mon Dec  3 16:11:31 2007
New Revision: 44552

URL: http://llvm.org/viewvc/llvm-project?rev=44552&view=rev
Log:
Few cleanups to patch 44551:

  http://llvm.org/viewvc/llvm-project?view=rev&revision=44551

Removed debugging fprintfs for printing targets.
Implemented error messages when processing invalid targets.

Modified:
    cfe/trunk/Driver/clang.cpp

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=44552&r1=44551&r2=44552&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Mon Dec  3 16:11:31 2007
@@ -432,12 +432,21 @@
   // Decompose the base triple into "arch" and suffix.
   std::string::size_type firstDash = base_triple.find("-");
   
-  // FIXME: Make this a diagnostic.
-  assert (firstDash != std::string::npos);
+  if (firstDash == std::string::npos) {
+    fprintf(stderr, 
+            "Malformed target triple: \"%s\" ('-' could not be found).\n",
+            base_triple.c_str());
+    exit (1);
+  }
   
   std::string suffix(base_triple,firstDash+1);
-  // FIXME: Make this a diagnostic.
-  assert (!suffix.empty());
+  
+  if (suffix.empty()) {
+    fprintf(stderr,
+            "Malformed target triple: \"%s\" (no vendor or OS).\n",
+            base_triple.c_str());
+    exit (1);
+  }
 
   // Create triple cacher.
   TripleProcessor tp(triples);
@@ -981,11 +990,6 @@
   { // Create triples, and create the TargetInfo.
     std::vector<std::string> triples;
     CreateTargetTriples(triples);
-    fprintf(stderr, "Targets:");
-    for (std::vector<std::string>::iterator I = triples.begin(), E = triples.end(); I !=E ; ++I)
-      fprintf (stderr, " %s", I->c_str());
-    fprintf(stderr,"\n");
-      
     Target = CreateTargetInfo(triples,Diags);
   }
   





More information about the cfe-commits mailing list