本文整理汇总了C++中DiagnosticsEngine::setClient方法的典型用法代码示例。如果您正苦于以下问题:C++ DiagnosticsEngine::setClient方法的具体用法?C++ DiagnosticsEngine::setClient怎么用?C++ DiagnosticsEngine::setClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiagnosticsEngine
的用法示例。
在下文中一共展示了DiagnosticsEngine::setClient方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetUpDiagnosticLog
static void SetUpDiagnosticLog(DiagnosticOptions *DiagOpts,
const CodeGenOptions *CodeGenOpts,
DiagnosticsEngine &Diags) {
std::string ErrorInfo;
bool OwnsStream = false;
raw_ostream *OS = &llvm::errs();
if (DiagOpts->DiagnosticLogFile != "-") {
// Create the output stream.
llvm::raw_fd_ostream *FileOS(
new llvm::raw_fd_ostream(DiagOpts->DiagnosticLogFile.c_str(),
ErrorInfo, llvm::raw_fd_ostream::F_Append));
if (!ErrorInfo.empty()) {
Diags.Report(diag::warn_fe_cc_log_diagnostics_failure)
<< DiagOpts->DumpBuildInformation << ErrorInfo;
} else {
FileOS->SetUnbuffered();
FileOS->SetUseAtomicWrites(true);
OS = FileOS;
OwnsStream = true;
}
}
// Chain in the diagnostic client which will log the diagnostics.
LogDiagnosticPrinter *Logger = new LogDiagnosticPrinter(*OS, DiagOpts,
OwnsStream);
if (CodeGenOpts)
Logger->setDwarfDebugFlags(CodeGenOpts->DwarfDebugFlags);
Diags.setClient(new ChainedDiagnosticConsumer(Diags.takeClient(), Logger));
}
示例2: Diags
FixItRewriter::FixItRewriter(DiagnosticsEngine &Diags, SourceManager &SourceMgr,
const LangOptions &LangOpts,
FixItOptions *FixItOpts)
: Diags(Diags),
Rewrite(SourceMgr, LangOpts),
FixItOpts(FixItOpts),
NumFailures(0),
PrevDiagSilenced(false) {
OwnsClient = Diags.ownsClient();
Client = Diags.takeClient();
Diags.setClient(this);
}
示例3: SetupSerializedDiagnostics
static void SetupSerializedDiagnostics(DiagnosticOptions *DiagOpts,
DiagnosticsEngine &Diags,
StringRef OutputFile) {
std::string ErrorInfo;
OwningPtr<llvm::raw_fd_ostream> OS;
OS.reset(new llvm::raw_fd_ostream(OutputFile.str().c_str(), ErrorInfo,
llvm::raw_fd_ostream::F_Binary));
if (!ErrorInfo.empty()) {
Diags.Report(diag::warn_fe_serialized_diag_failure)
<< OutputFile << ErrorInfo;
return;
}
DiagnosticConsumer *SerializedConsumer =
clang::serialized_diags::create(OS.take(), DiagOpts);
Diags.setClient(new ChainedDiagnosticConsumer(Diags.takeClient(),
SerializedConsumer));
}
示例4: SetUpBuildDumpLog
// Diagnostics
static void SetUpBuildDumpLog(DiagnosticOptions *DiagOpts,
unsigned argc, const char* const *argv,
DiagnosticsEngine &Diags) {
std::string ErrorInfo;
OwningPtr<raw_ostream> OS(
new llvm::raw_fd_ostream(DiagOpts->DumpBuildInformation.c_str(),ErrorInfo));
if (!ErrorInfo.empty()) {
Diags.Report(diag::err_fe_unable_to_open_logfile)
<< DiagOpts->DumpBuildInformation << ErrorInfo;
return;
}
(*OS) << "clang -cc1 command line arguments: ";
for (unsigned i = 0; i != argc; ++i)
(*OS) << argv[i] << ' ';
(*OS) << '\n';
// Chain in a diagnostic client which will log the diagnostics.
DiagnosticConsumer *Logger =
new TextDiagnosticPrinter(*OS.take(), DiagOpts, /*OwnsOutputStream=*/true);
Diags.setClient(new ChainedDiagnosticConsumer(Diags.takeClient(), Logger));
}