From: Ted Kremenek Date: Fri, 11 Nov 2011 00:07:43 +0000 (+0000) Subject: Add top-level driver option '--serialize-diagnostics' for serialize compiler diagnost... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=36f6e30d5c21a693abf2612ef086e83e9696f0e0;p=clang Add top-level driver option '--serialize-diagnostics' for serialize compiler diagnostics to a file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144339 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index e8d06f994f..882805bc2f 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -232,7 +232,7 @@ def dump_build_information : Separate<"-dump-build-information">, HelpText<"output a dump of some build information to a file">; def diagnostic_log_file : Separate<"-diagnostic-log-file">, HelpText<"Filename (or -) to log diagnostics to">; -def diagnostic_serialized_file : Separate<"-diagnostic-serialized-file">, +def diagnostic_serialized_file : Separate<"-serialize-diagnostic-file">, MetaVarName<"">, HelpText<"File for serializing diagnostics in a binary format">; def fno_show_column : Flag<"-fno-show-column">, diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 68d132dc17..1e2274a8b7 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -846,6 +846,8 @@ def _relocatable_pch : Flag<"--relocatable-pch">, def _resource_EQ : Joined<"--resource=">, Alias; def _resource : Separate<"--resource">, Alias; def _save_temps : Flag<"--save-temps">, Alias; +def _serialize_diags : Separate<"--serialize-diagnostics">, Flags<[DriverOption]>, + HelpText<"Serialize compiler diagnostics to a file">; def _shared : Flag<"--shared">, Alias; def _signed_char : Flag<"--signed-char">, Alias; def _specs_EQ : Joined<"--specs=">, Alias; diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 6576fcae3e..9faac7174a 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2213,6 +2213,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Args.AddLastArg(CmdArgs, options::OPT_dM); Args.AddLastArg(CmdArgs, options::OPT_dD); + + // Handle serialized diagnostics. + if (Arg *A = Args.getLastArg(options::OPT__serialize_diags)) { + CmdArgs.push_back("-serialize-diagnostic-file"); + CmdArgs.push_back(Args.MakeArgString(A->getValue(Args))); + } // Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM option // parser.