]> granicus.if.org Git - clang/commitdiff
Few cleanups to patch 44551:
authorTed Kremenek <kremenek@apple.com>
Mon, 3 Dec 2007 22:11:31 +0000 (22:11 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 3 Dec 2007 22:11:31 +0000 (22:11 +0000)
  http://llvm.org/viewvc/llvm-project?view=rev&revision=44551

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

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

Driver/clang.cpp

index 5a27d8fd13e09deb82fd09a2b5da7d0af195cd02..b403dd324a45a58ef2be9539b0ac6872f4ee3303 100644 (file)
@@ -432,12 +432,21 @@ static void CreateTargetTriples(std::vector<std::string>& triples) {
   // 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 @@ int main(int argc, char **argv) {
   { // 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);
   }