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
This commit is contained in:
Daniel Dunbar 2011-09-29 02:03:01 +00:00
Родитель be1aa41027
Коммит aeacae523a
4 изменённых файлов: 12 добавлений и 27 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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; }

Просмотреть файл

@ -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.

Просмотреть файл

@ -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 &&