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

Also remove an obsolete utostr call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140511 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 3fd91b2..3c2b84f 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/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