mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-03 18:36:05 +00:00
when tblgen fills in all the subgroup info, clang is ready for it.
This depends on r69249 of llvm. llvm-svn: 69250
This commit is contained in:
parent
13507d6cba
commit
e82c3cc848
@ -18,10 +18,7 @@
|
|||||||
//
|
//
|
||||||
// Each warning option controls any number of actual warnings.
|
// Each warning option controls any number of actual warnings.
|
||||||
// Given a warning option 'foo', the following are valid:
|
// Given a warning option 'foo', the following are valid:
|
||||||
//
|
// -Wfoo, -Wno-foo, -Werror=foo
|
||||||
// -Wfoo -> alias of -Wfoo=warn
|
|
||||||
// -Wno-foo -> alias of -Wfoo=ignore
|
|
||||||
// -Werror=foo -> alias of -Wfoo=error
|
|
||||||
//
|
//
|
||||||
#include "clang-cc.h"
|
#include "clang-cc.h"
|
||||||
#include "clang/Basic/Diagnostic.h"
|
#include "clang/Basic/Diagnostic.h"
|
||||||
@ -44,8 +41,9 @@ static llvm::cl::opt<bool> OptPedanticErrors("pedantic-errors");
|
|||||||
static llvm::cl::opt<bool> OptNoWarnings("w");
|
static llvm::cl::opt<bool> OptNoWarnings("w");
|
||||||
|
|
||||||
struct WarningOption {
|
struct WarningOption {
|
||||||
const char *Name;
|
const char *Name;
|
||||||
const short *Members;
|
const short *Members;
|
||||||
|
const char *SubGroups;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GET_DIAG_ARRAYS
|
#define GET_DIAG_ARRAYS
|
||||||
@ -66,6 +64,25 @@ static bool WarningOptionCompare(const WarningOption &LHS,
|
|||||||
return strcmp(LHS.Name, RHS.Name) < 0;
|
return strcmp(LHS.Name, RHS.Name) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void MapGroupMembers(const WarningOption *Group, diag::Mapping Mapping,
|
||||||
|
Diagnostic &Diags,
|
||||||
|
llvm::SmallVectorImpl<unsigned short> &ControlledDiags) {
|
||||||
|
// Option exists, poke all the members of its diagnostic set.
|
||||||
|
if (const short *Member = Group->Members) {
|
||||||
|
for (; *Member != -1; ++Member) {
|
||||||
|
Diags.setDiagnosticMapping(*Member, Mapping);
|
||||||
|
ControlledDiags.push_back(*Member);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable/disable all subgroups along with this one.
|
||||||
|
if (const char *SubGroups = Group->SubGroups) {
|
||||||
|
for (; *SubGroups != (char)-1; ++SubGroups)
|
||||||
|
MapGroupMembers(&OptionTable[(unsigned char)*SubGroups], Mapping,
|
||||||
|
Diags, ControlledDiags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool clang::ProcessWarningOptions(Diagnostic &Diags) {
|
bool clang::ProcessWarningOptions(Diagnostic &Diags) {
|
||||||
Diags.setSuppressSystemWarnings(true); // Default to -Wno-system-headers
|
Diags.setSuppressSystemWarnings(true); // Default to -Wno-system-headers
|
||||||
Diags.setIgnoreAllWarnings(OptNoWarnings);
|
Diags.setIgnoreAllWarnings(OptNoWarnings);
|
||||||
@ -125,7 +142,7 @@ bool clang::ProcessWarningOptions(Diagnostic &Diags) {
|
|||||||
OptStart = Specifier;
|
OptStart = Specifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
WarningOption Key = { OptStart, 0 };
|
WarningOption Key = { OptStart, 0, 0 };
|
||||||
const WarningOption *Found =
|
const WarningOption *Found =
|
||||||
std::lower_bound(OptionTable, OptionTable + OptionTableSize, Key,
|
std::lower_bound(OptionTable, OptionTable + OptionTableSize, Key,
|
||||||
WarningOptionCompare);
|
WarningOptionCompare);
|
||||||
@ -135,11 +152,7 @@ bool clang::ProcessWarningOptions(Diagnostic &Diags) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option exists, poke all the members of its diagnostic set.
|
MapGroupMembers(Found, Mapping, Diags, ControlledDiags);
|
||||||
for (const short *Member = Found->Members; *Member != -1; ++Member) {
|
|
||||||
Diags.setDiagnosticMapping(*Member, Mapping);
|
|
||||||
ControlledDiags.push_back(*Member);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If -pedantic or -pedantic-errors was specified, then we want to map all
|
// If -pedantic or -pedantic-errors was specified, then we want to map all
|
||||||
|
Loading…
x
Reference in New Issue
Block a user