From 89ea0b05207d45c145fb525df554b3b986ae379b Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Thu, 18 Jun 2020 08:57:50 -0400 Subject: [MC] Pass down argv0 & cc1 cmd-line to the back-end and store in MCTargetOptions When targetting CodeView, the goal is to store argv0 & cc1 cmd-line in the emitted .OBJ, in order to allow a reproducer from the .OBJ alone. This patch is to simplify https://reviews.llvm.org/D80833 --- clang/lib/Frontend/CompilerInvocation.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 4c05717..1af4153 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3627,7 +3627,8 @@ static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args, bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, ArrayRef CommandLineArgs, - DiagnosticsEngine &Diags) { + DiagnosticsEngine &Diags, + const char *Argv0) { bool Success = true; // Parse the arguments. @@ -3747,6 +3748,11 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, Res.getCodeGenOpts().FineGrainedBitfieldAccesses = false; Diags.Report(diag::warn_drv_fine_grained_bitfield_accesses_ignored); } + + // Store the command-line for using in the CodeView backend. + Res.getCodeGenOpts().Argv0 = Argv0; + Res.getCodeGenOpts().CommandLineArgs = CommandLineArgs; + return Success; } -- cgit v1.1