/// attached to (and, then, owned by) the returned Diagnostic
/// object.
///
+ /// \param CodeGenOpts If non-NULL, the code gen options in use, which may be
+ /// used by some diagnostics printers (for logging purposes only).
+ ///
/// \return The new object on success, or null on failure.
static llvm::IntrusiveRefCntPtr<Diagnostic>
createDiagnostics(const DiagnosticOptions &Opts, int Argc,
const char* const *Argv,
- DiagnosticClient *Client = 0);
+ DiagnosticClient *Client = 0,
+ const CodeGenOptions *CodeGenOpts = 0);
/// Create the file manager and replace any existing one with it.
void createFileManager();
}
static void SetUpDiagnosticLog(const DiagnosticOptions &DiagOpts,
+ const CodeGenOptions *CodeGenOpts,
Diagnostic &Diags) {
std::string ErrorInfo;
bool OwnsStream = false;
}
// Chain in the diagnostic client which will log the diagnostics.
- DiagnosticClient *Logger = new LogDiagnosticPrinter(*OS, DiagOpts,
- OwnsStream);
+ LogDiagnosticPrinter *Logger = new LogDiagnosticPrinter(*OS, DiagOpts,
+ OwnsStream);
+ if (CodeGenOpts)
+ Logger->setDwarfDebugFlags(CodeGenOpts->DwarfDebugFlags);
Diags.setClient(new ChainedDiagnosticClient(Diags.takeClient(), Logger));
}
void CompilerInstance::createDiagnostics(int Argc, const char* const *Argv,
DiagnosticClient *Client) {
- Diagnostics = createDiagnostics(getDiagnosticOpts(), Argc, Argv, Client);
+ Diagnostics = createDiagnostics(getDiagnosticOpts(), Argc, Argv, Client,
+ &getCodeGenOpts());
}
llvm::IntrusiveRefCntPtr<Diagnostic>
CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts,
int Argc, const char* const *Argv,
- DiagnosticClient *Client) {
+ DiagnosticClient *Client,
+ const CodeGenOptions *CodeGenOpts) {
llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
llvm::IntrusiveRefCntPtr<Diagnostic> Diags(new Diagnostic(DiagID));
// Chain in -diagnostic-log-file dumper, if requested.
if (!Opts.DiagnosticLogFile.empty())
- SetUpDiagnosticLog(Opts, *Diags);
+ SetUpDiagnosticLog(Opts, CodeGenOpts, *Diags);
if (!Opts.DumpBuildInformation.empty())
SetUpBuildDumpLog(Opts, Argc, Argv, *Diags);