[cfe-commits] r140771 - in /cfe/trunk: include/clang/Basic/Diagnostic.h include/clang/Basic/DiagnosticIDs.h lib/Basic/Diagnostic.cpp lib/Basic/DiagnosticIDs.cpp
Daniel Dunbar
daniel at zuster.org
Wed Sep 28 19:03:01 PDT 2011
Author: ddunbar
Date: Wed Sep 28 21:03:01 2011
New Revision: 140771
URL: http://llvm.org/viewvc/llvm-project?rev=140771&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/Basic/Diagnostic.h
cfe/trunk/include/clang/Basic/DiagnosticIDs.h
cfe/trunk/lib/Basic/Diagnostic.cpp
cfe/trunk/lib/Basic/DiagnosticIDs.cpp
Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=140771&r1=140770&r2=140771&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Wed Sep 28 21:03:01 2011
@@ -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);
Modified: cfe/trunk/include/clang/Basic/DiagnosticIDs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticIDs.h?rev=140771&r1=140770&r2=140771&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticIDs.h (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticIDs.h Wed Sep 28 21:03:01 2011
@@ -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; }
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=140771&r1=140770&r2=140771&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Wed Sep 28 21:03:01 2011
@@ -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.
Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=140771&r1=140770&r2=140771&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Wed Sep 28 21:03:01 2011
@@ -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 &&
More information about the cfe-commits
mailing list