Basic/Diagnostic: Kill off a few unnecessary functions now that refactoring is done, and add a note that the new setDiagnosticGroup{...} methods only operate on the current diagnostic state.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140771 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index 02a937d..492c8b0 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -187,13 +187,6 @@
       DiagMap[Diag] = Info;
     }
 
-    DiagnosticMappingInfo getMappingInfo(diag::kind Diag) const {
-      const_iterator I = DiagMap.find(Diag);
-      if (I != DiagMap.end())
-        return I->second;
-      return DiagnosticMappingInfo::MakeUnset();
-    }
-
     DiagnosticMappingInfo &getOrAddMappingInfo(diag::kind Diag);
 
     const_iterator begin() const { return DiagMap.begin(); }
@@ -457,12 +450,14 @@
   bool setDiagnosticGroupMapping(StringRef Group, diag::Mapping Map,
                                  SourceLocation Loc = SourceLocation());
 
-  /// \brief Set the warning-as-error flag for the given diagnostic group.
+  /// \brief Set the warning-as-error flag for the given diagnostic group. This
+  /// function always only operates on the current diagnostic state.
   ///
   /// \returns True if the given group is unknown, false otherwise.
   bool setDiagnosticGroupWarningAsError(StringRef Group, bool Enabled);
 
-  /// \brief Set the error-as-fatal flag for the given diagnostic group.
+  /// \brief Set the error-as-fatal flag for the given diagnostic group. This
+  /// function always only operates on the current diagnostic state.
   ///
   /// \returns True if the given group is unknown, false otherwise.
   bool setDiagnosticGroupErrorAsFatal(StringRef Group, bool Enabled);
diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h
index a0aec24..e158bf5 100644
--- a/include/clang/Basic/DiagnosticIDs.h
+++ b/include/clang/Basic/DiagnosticIDs.h
@@ -78,14 +78,8 @@
   unsigned HasNoErrorAsFatal : 1;
 
 public:
-  static DiagnosticMappingInfo MakeUnset() {
-    DiagnosticMappingInfo Result;
-    Result.Mapping = 0;
-    return Result;
-  }
-
-  static DiagnosticMappingInfo MakeInfo(diag::Mapping Mapping,
-                                        bool IsUser, bool IsPragma) {
+  static DiagnosticMappingInfo Make(diag::Mapping Mapping, bool IsUser,
+                                    bool IsPragma) {
     DiagnosticMappingInfo Result;
     Result.Mapping = Mapping;
     Result.IsUser = IsUser;
@@ -96,8 +90,6 @@
     return Result;
   }
 
-  bool isUnset() const { return Mapping == 0; }
-
   diag::Mapping getMapping() const { return diag::Mapping(Mapping); }
   void setMapping(diag::Mapping Value) { Mapping = Value; }
 
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index 5b81458..cfe617e 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -172,7 +172,7 @@
   bool isPragma = L.isValid();
   FullSourceLoc Loc(L, *SourceMgr);
   FullSourceLoc LastStateChangePos = DiagStatePoints.back().Loc;
-  DiagnosticMappingInfo MappingInfo = DiagnosticMappingInfo::MakeInfo(
+  DiagnosticMappingInfo MappingInfo = DiagnosticMappingInfo::Make(
     Map, /*IsUser=*/true, isPragma);
 
   // Common case; setting all the diagnostics of a group in one place.
diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp
index b0d2f44..9d460a5 100644
--- a/lib/Basic/DiagnosticIDs.cpp
+++ b/lib/Basic/DiagnosticIDs.cpp
@@ -185,7 +185,7 @@
 }
 
 static DiagnosticMappingInfo GetDefaultDiagMappingInfo(unsigned DiagID) {
-  DiagnosticMappingInfo Info = DiagnosticMappingInfo::MakeInfo(
+  DiagnosticMappingInfo Info = DiagnosticMappingInfo::Make(
     diag::MAP_FATAL, /*IsUser=*/false, /*IsPragma=*/false);
 
   if (const StaticDiagInfoRec *StaticInfo = GetDiagInfo(DiagID)) {
@@ -243,13 +243,11 @@
   diag::kind Diag)
 {
   std::pair<iterator, bool> Result = DiagMap.insert(
-    std::make_pair(Diag, DiagnosticMappingInfo::MakeUnset()));
+    std::make_pair(Diag, DiagnosticMappingInfo()));
 
   // Initialize the entry if we added it.
-  if (Result.second) {
-    assert(Result.first->second.isUnset() && "unexpected unset entry");
+  if (Result.second)
     Result.first->second = GetDefaultDiagMappingInfo(Diag);
-  }
 
   return Result.first->second;
 }
@@ -598,8 +596,8 @@
       Result = DiagnosticIDs::Fatal;
   }
 
-  // If we are in a system header, we ignore it.
-  // We also want to ignore extensions and warnings in -Werror and
+  // If we are in a system header, we ignore it. We look at the diagnostic class
+  // because we also want to ignore extensions and warnings in -Werror and
   // -pedantic-errors modes, which *map* warnings/extensions to errors.
   if (Result >= DiagnosticIDs::Warning &&
       DiagClass != CLASS_ERROR &&