]> granicus.if.org Git - clang/commitdiff
Basic/Diagnostic: Kill off a few unnecessary functions now that refactoring is done...
authorDaniel Dunbar <daniel@zuster.org>
Thu, 29 Sep 2011 02:03:01 +0000 (02:03 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 29 Sep 2011 02:03:01 +0000 (02:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140771 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Diagnostic.h
include/clang/Basic/DiagnosticIDs.h
lib/Basic/Diagnostic.cpp
lib/Basic/DiagnosticIDs.cpp

index 02a937d1a9ea14ae302bb972dab8fbc7531dea91..492c8b069e1ca12523f33fe63e0a1091ff8369e6 100644 (file)
@@ -187,13 +187,6 @@ private:
       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 @@ public:
   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);
index a0aec249cd43f2773206116e62d419cadc990375..e158bf52b5c72fe52b5780408d49f62f797618e0 100644 (file)
@@ -78,14 +78,8 @@ class DiagnosticMappingInfo {
   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 @@ public:
     return Result;
   }
 
-  bool isUnset() const { return Mapping == 0; }
-
   diag::Mapping getMapping() const { return diag::Mapping(Mapping); }
   void setMapping(diag::Mapping Value) { Mapping = Value; }
 
index 5b814586144b367abece9a39bb47a429621853f2..cfe617e2b3c148ad65d7ad97280f87054267da4e 100644 (file)
@@ -172,7 +172,7 @@ void DiagnosticsEngine::setDiagnosticMapping(diag::kind Diag, diag::Mapping Map,
   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.
index b0d2f449f6a28d1646f5290f53675089199b05cc..9d460a5c9a8871ca7c5c9be0a59e802d89614388 100644 (file)
@@ -185,7 +185,7 @@ static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) {
 }
 
 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 @@ DiagnosticMappingInfo &DiagnosticsEngine::DiagState::getOrAddMappingInfo(
   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 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass,
       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 &&