本文整理汇总了C++中DiagnosticEngine::resetHadAnyError方法的典型用法代码示例。如果您正苦于以下问题:C++ DiagnosticEngine::resetHadAnyError方法的具体用法?C++ DiagnosticEngine::resetHadAnyError怎么用?C++ DiagnosticEngine::resetHadAnyError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiagnosticEngine
的用法示例。
在下文中一共展示了DiagnosticEngine::resetHadAnyError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: frontend_main
//.........这里部分代码省略.........
FrontendOptions::NoneAction) {
Instance.getDiags().diagnose(SourceLoc(),
diag::error_missing_frontend_action);
return 1;
}
// TODO: reorder, if possible, so that diagnostics emitted during
// CompilerInvocation::parseArgs are included in the serialized file.
std::unique_ptr<DiagnosticConsumer> SerializedConsumer;
{
const std::string &SerializedDiagnosticsPath =
Invocation.getFrontendOptions().SerializedDiagnosticsPath;
if (!SerializedDiagnosticsPath.empty()) {
std::error_code EC;
std::unique_ptr<llvm::raw_fd_ostream> OS;
OS.reset(new llvm::raw_fd_ostream(SerializedDiagnosticsPath,
EC,
llvm::sys::fs::F_None));
if (EC) {
Instance.getDiags().diagnose(SourceLoc(),
diag::cannot_open_serialized_file,
SerializedDiagnosticsPath, EC.message());
return 1;
}
SerializedConsumer.reset(
serialized_diagnostics::createConsumer(std::move(OS)));
Instance.addDiagnosticConsumer(SerializedConsumer.get());
}
}
std::unique_ptr<DiagnosticConsumer> FixitsConsumer;
{
const std::string &FixitsOutputPath =
Invocation.getFrontendOptions().FixitsOutputPath;
if (!FixitsOutputPath.empty()) {
std::error_code EC;
std::unique_ptr<llvm::raw_fd_ostream> OS;
OS.reset(new llvm::raw_fd_ostream(FixitsOutputPath,
EC,
llvm::sys::fs::F_None));
if (EC) {
Instance.getDiags().diagnose(SourceLoc(),
diag::cannot_open_file,
FixitsOutputPath, EC.message());
return 1;
}
FixitsConsumer.reset(new JSONFixitWriter(std::move(OS),
Invocation.getDiagnosticOptions()));
Instance.addDiagnosticConsumer(FixitsConsumer.get());
}
}
if (Invocation.getDiagnosticOptions().UseColor)
PDC.forceColors();
if (Invocation.getFrontendOptions().PrintStats) {
llvm::EnableStatistics();
}
if (Invocation.getDiagnosticOptions().VerifyDiagnostics) {
enableDiagnosticVerifier(Instance.getSourceMgr());
}
DependencyTracker depTracker;
if (!Invocation.getFrontendOptions().DependenciesFilePath.empty() ||
!Invocation.getFrontendOptions().ReferenceDependenciesFilePath.empty()) {
Instance.setDependencyTracker(&depTracker);
}
if (Instance.setup(Invocation)) {
return 1;
}
int ReturnValue = 0;
bool HadError = performCompile(Instance, Invocation, Args, ReturnValue) ||
Instance.getASTContext().hadError();
if (!HadError && !Invocation.getFrontendOptions().DumpAPIPath.empty()) {
HadError = dumpAPI(Instance.getMainModule(),
Invocation.getFrontendOptions().DumpAPIPath);
}
if (Invocation.getDiagnosticOptions().VerifyDiagnostics) {
HadError = verifyDiagnostics(Instance.getSourceMgr(),
Instance.getInputBufferIDs());
DiagnosticEngine &diags = Instance.getDiags();
if (diags.hasFatalErrorOccurred() &&
!Invocation.getDiagnosticOptions().ShowDiagnosticsAfterFatalError) {
diags.resetHadAnyError();
diags.diagnose(SourceLoc(), diag::verify_encountered_fatal);
HadError = true;
}
}
return (HadError ? 1 : ReturnValue);
}