From: George Karpenkov Date: Tue, 23 Jan 2018 19:28:52 +0000 (+0000) Subject: [analyzer] Show full analyzer invocation for reproducibility in HTML reports X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74a822fbaaac85aebc68c4be95e90a0186707bce;p=clang [analyzer] Show full analyzer invocation for reproducibility in HTML reports Analyzing problems which appear in scan-build results can be very difficult, as after the launch no exact invocation is stored, and it's super-hard to launch the debugger. With this patch, the exact analyzer invocation appears in the footer, and can be copied to debug/check reproducibility/etc. rdar://35980230 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323245 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h b/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h index ce50cc582d..2f28addb96 100644 --- a/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h +++ b/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h @@ -139,6 +139,10 @@ public: AnalysisPurgeMode AnalysisPurgeOpt; std::string AnalyzeSpecificFunction; + + /// Store full compiler invocation for reproducible instructions in the + /// generated report. + std::string FullCompilerInvocation; /// \brief The maximum number of times the analyzer visits a block. unsigned maxBlockVisitOnPath; diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 74db7f89cf..b107f65adf 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -305,6 +305,14 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, } } + llvm::raw_string_ostream os(Opts.FullCompilerInvocation); + for (unsigned i=0; i