本文整理汇总了C++中IntrusiveRefCntPtr::getDiagnosticsInGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ IntrusiveRefCntPtr::getDiagnosticsInGroup方法的具体用法?C++ IntrusiveRefCntPtr::getDiagnosticsInGroup怎么用?C++ IntrusiveRefCntPtr::getDiagnosticsInGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntrusiveRefCntPtr
的用法示例。
在下文中一共展示了IntrusiveRefCntPtr::getDiagnosticsInGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessWarningOptions
//.........这里部分代码省略.........
bool isPositive = true;
if (Opt.startswith("no-")) {
isPositive = false;
Opt = Opt.substr(3);
}
// Figure out how this option affects the warning. If -Wfoo, map the
// diagnostic to a warning, if -Wno-foo, map it to ignore.
diag::Mapping Mapping = isPositive ? diag::MAP_WARNING : diag::MAP_IGNORE;
// -Wsystem-headers is a special case, not driven by the option table. It
// cannot be controlled with -Werror.
if (Opt == "system-headers") {
if (SetDiagnostic)
Diags.setSuppressSystemWarnings(!isPositive);
continue;
}
// -Weverything is a special case as well. It implicitly enables all
// warnings, including ones not explicitly in a warning group.
if (Opt == "everything") {
if (SetDiagnostic) {
if (isPositive) {
Diags.setEnableAllWarnings(true);
} else {
Diags.setEnableAllWarnings(false);
Diags.setMappingToAllDiagnostics(diag::MAP_IGNORE);
}
}
continue;
}
// -Werror/-Wno-error is a special case, not controlled by the option
// table. It also has the "specifier" form of -Werror=foo and -Werror-foo.
if (Opt.startswith("error")) {
StringRef Specifier;
if (Opt.size() > 5) { // Specifier must be present.
if ((Opt[5] != '=' && Opt[5] != '-') || Opt.size() == 6) {
if (Report)
Diags.Report(diag::warn_unknown_warning_specifier)
<< "-Werror" << ("-W" + OrigOpt.str());
continue;
}
Specifier = Opt.substr(6);
}
if (Specifier.empty()) {
if (SetDiagnostic)
Diags.setWarningsAsErrors(isPositive);
continue;
}
if (SetDiagnostic) {
// Set the warning as error flag for this specifier.
Diags.setDiagnosticGroupWarningAsError(Specifier, isPositive);
} else if (DiagIDs->getDiagnosticsInGroup(Specifier, _Diags)) {
EmitUnknownDiagWarning(Diags, "-Werror=", Specifier, isPositive);
}
continue;
}
// -Wfatal-errors is yet another special case.
if (Opt.startswith("fatal-errors")) {
StringRef Specifier;
if (Opt.size() != 12) {
if ((Opt[12] != '=' && Opt[12] != '-') || Opt.size() == 13) {
if (Report)
Diags.Report(diag::warn_unknown_warning_specifier)
<< "-Wfatal-errors" << ("-W" + OrigOpt.str());
continue;
}
Specifier = Opt.substr(13);
}
if (Specifier.empty()) {
if (SetDiagnostic)
Diags.setErrorsAsFatal(isPositive);
continue;
}
if (SetDiagnostic) {
// Set the error as fatal flag for this specifier.
Diags.setDiagnosticGroupErrorAsFatal(Specifier, isPositive);
} else if (DiagIDs->getDiagnosticsInGroup(Specifier, _Diags)) {
EmitUnknownDiagWarning(Diags, "-Wfatal-errors=", Specifier,
isPositive);
}
continue;
}
if (Report) {
if (DiagIDs->getDiagnosticsInGroup(Opt, _Diags))
EmitUnknownDiagWarning(Diags, isPositive ? "-W" : "-Wno-", Opt,
isPositive);
} else {
Diags.setDiagnosticGroupMapping(Opt, Mapping);
}
}
}
}