[cfe-commits] r140763 - in /cfe/trunk: include/clang/Basic/Diagnostic.h lib/Basic/Diagnostic.cpp

Daniel Dunbar daniel at zuster.org
Wed Sep 28 20:34:47 CDT 2011


Author: ddunbar
Date: Wed Sep 28 20:34:47 2011
New Revision: 140763

URL: http://llvm.org/viewvc/llvm-project?rev=140763&view=rev
Log:
Basic/Diagnostics: Move setDiagnosticMapping() to using DiagnosticMappingInfo
and eliminate setDiagnosticMappingInternal.

Modified:
    cfe/trunk/include/clang/Basic/Diagnostic.h
    cfe/trunk/lib/Basic/Diagnostic.cpp

Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=140763&r1=140762&r2=140763&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Wed Sep 28 20:34:47 2011
@@ -566,13 +566,6 @@
   /// \brief Report the delayed diagnostic.
   void ReportDelayed();
 
-  void setDiagnosticMappingInternal(unsigned DiagId, diag::Mapping Map,
-                                    DiagState *State,
-                                    bool isUser, bool isPragma) const {
-    State->setMappingInfo((diag::kind)DiagId, DiagnosticMappingInfo::MakeInfo(
-                            Map, isUser, isPragma));
-  }
-
   // This is private state used by DiagnosticBuilder.  We put it here instead of
   // in DiagnosticBuilder in order to keep DiagnosticBuilder a small lightweight
   // object.  This implementation choice means that we can only have one

Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=140763&r1=140762&r2=140763&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Wed Sep 28 20:34:47 2011
@@ -172,10 +172,12 @@
   bool isPragma = L.isValid();
   FullSourceLoc Loc(L, *SourceMgr);
   FullSourceLoc LastStateChangePos = DiagStatePoints.back().Loc;
+  DiagnosticMappingInfo MappingInfo = DiagnosticMappingInfo::MakeInfo(
+    Map, /*IsUser=*/true, isPragma);
 
   // Common case; setting all the diagnostics of a group in one place.
   if (Loc.isInvalid() || Loc == LastStateChangePos) {
-    setDiagnosticMappingInternal(Diag, Map, GetCurDiagState(), true, isPragma);
+    GetCurDiagState()->setMappingInfo(Diag, MappingInfo);
     return;
   }
 
@@ -188,7 +190,7 @@
     // the new state became active.
     DiagStates.push_back(*GetCurDiagState());
     PushDiagStatePoint(&DiagStates.back(), Loc);
-    setDiagnosticMappingInternal(Diag, Map, GetCurDiagState(), true, isPragma);
+    GetCurDiagState()->setMappingInfo(Diag, MappingInfo);
     return;
   }
 
@@ -201,12 +203,12 @@
   // Update all diagnostic states that are active after the given location.
   for (DiagStatePointsTy::iterator
          I = Pos+1, E = DiagStatePoints.end(); I != E; ++I) {
-    setDiagnosticMappingInternal(Diag, Map, I->State, true, isPragma);
+    GetCurDiagState()->setMappingInfo(Diag, MappingInfo);
   }
 
   // If the location corresponds to an existing point, just update its state.
   if (Pos->Loc == Loc) {
-    setDiagnosticMappingInternal(Diag, Map, Pos->State, true, isPragma);
+    GetCurDiagState()->setMappingInfo(Diag, MappingInfo);
     return;
   }
 
@@ -215,7 +217,7 @@
   Pos->Loc.isBeforeInTranslationUnitThan(Loc);
   DiagStates.push_back(*Pos->State);
   DiagState *NewState = &DiagStates.back();
-  setDiagnosticMappingInternal(Diag, Map, NewState, true, isPragma);
+  GetCurDiagState()->setMappingInfo(Diag, MappingInfo);
   DiagStatePoints.insert(Pos+1, DiagStatePoint(NewState,
                                                FullSourceLoc(Loc, *SourceMgr)));
 }




More information about the cfe-commits mailing list