diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-04-07 18:59:02 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-04-07 18:59:02 +0000 |
commit | b6534bbee90bf73f364072051d10b60352d43c3e (patch) | |
tree | acc459cace5ce5456716a925d3413e9d4c517b64 | |
parent | 28f14933edc863821e4f2ffa3663835c62440dcb (diff) |
Fronted/CC_LOG_DIAGNOSTICS: Wire up dwarf-debug-flags support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129095 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 6 | ||||
-rw-r--r-- | lib/Frontend/CompilerInstance.cpp | 15 |
2 files changed, 15 insertions, 6 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 2c37c9568e..004c8896e2 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -470,11 +470,15 @@ public: /// 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(); diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 94271d3b32..bc63e985fe 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -108,6 +108,7 @@ static void SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts, } static void SetUpDiagnosticLog(const DiagnosticOptions &DiagOpts, + const CodeGenOptions *CodeGenOpts, Diagnostic &Diags) { std::string ErrorInfo; bool OwnsStream = false; @@ -129,20 +130,24 @@ static void SetUpDiagnosticLog(const DiagnosticOptions &DiagOpts, } // 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 @@ CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts, // 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); |