[cfe-commits] r129095 - in /cfe/trunk: include/clang/Frontend/CompilerInstance.h lib/Frontend/CompilerInstance.cpp
Daniel Dunbar
daniel at zuster.org
Thu Apr 7 11:59:02 PDT 2011
Author: ddunbar
Date: Thu Apr 7 13:59:02 2011
New Revision: 129095
URL: http://llvm.org/viewvc/llvm-project?rev=129095&view=rev
Log:
Fronted/CC_LOG_DIAGNOSTICS: Wire up dwarf-debug-flags support.
Modified:
cfe/trunk/include/clang/Frontend/CompilerInstance.h
cfe/trunk/lib/Frontend/CompilerInstance.cpp
Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=129095&r1=129094&r2=129095&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Thu Apr 7 13:59:02 2011
@@ -470,11 +470,15 @@
/// 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();
Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=129095&r1=129094&r2=129095&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Thu Apr 7 13:59:02 2011
@@ -108,6 +108,7 @@
}
static void SetUpDiagnosticLog(const DiagnosticOptions &DiagOpts,
+ const CodeGenOptions *CodeGenOpts,
Diagnostic &Diags) {
std::string ErrorInfo;
bool OwnsStream = false;
@@ -129,20 +130,24 @@
}
// 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));
@@ -159,7 +164,7 @@
// 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);
More information about the cfe-commits
mailing list