Don't print a stray ] at the end of diagnostics.

Also remove an obsolete utostr call.

llvm-svn: 140511
diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp
index 3fd91b2..3c2b84f 100644
--- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -20,7 +20,6 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/StringExtras.h"
 #include <algorithm>
 using namespace clang;
 
@@ -1070,15 +1069,17 @@
       DiagnosticIDs::getCategoryNumberForDiag(Info.getID());
     if (DiagCategory) {
       OS << (Started ? "," : " [");
+      Started = true;
       if (DiagOpts.ShowCategories == 1)
-        OS << llvm::utostr(DiagCategory);
+        OS << DiagCategory;
       else {
         assert(DiagOpts.ShowCategories == 2 && "Invalid ShowCategories value");
         OS << DiagnosticIDs::getCategoryNameFromID(DiagCategory);
       }
     }
   }
-  OS << "]";
+  if (Started)
+    OS << ']';
 }
 
 /// \brief Print the given string to a stream, word-wrapping it to