Teach TextDiagnosticPrinter to print out '-Werror' in addition to the warning flag for a warning mapped to an error.

For example:

t.c:7:9: error: using the result of an assignment as a condition without parentheses [-Werror,-Wparentheses]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126466 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 04c6a68..0849153 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -905,9 +905,21 @@
 
   std::string OptionName;
   if (DiagOpts->ShowOptionNames) {
+    // Was this a warning mapped to an error using -Werror or pragma?
+    if (Level == Diagnostic::Error &&
+        DiagnosticIDs::isBuiltinWarningOrExtension(Info.getID())) {
+      diag::Mapping mapping = diag::MAP_IGNORE;
+      Info.getDiags()->getDiagnosticLevel(Info.getID(), Info.getLocation(), 
+                                          &mapping);
+      if (mapping == diag::MAP_WARNING)
+        OptionName += "-Werror";
+    }
+
     if (const char *
           Opt = DiagnosticIDs::getWarningOptionForDiag(Info.getID())) {
-      OptionName = "-W";
+      if (!OptionName.empty())
+        OptionName += ',';
+      OptionName += "-W";
       OptionName += Opt;
     } else if (Info.getID() == diag::fatal_too_many_errors) {
       OptionName = "-ferror-limit=";