[ThinLTO] Fix empty .llvmcmd sections
authorMircea Trofin <mtrofin@google.com>
Thu, 29 Oct 2020 03:16:51 +0000 (20:16 -0700)
committerMircea Trofin <mtrofin@google.com>
Thu, 29 Oct 2020 16:57:42 +0000 (09:57 -0700)
commit13aee94bc710bfa6277c1f07146c714ee65bf2de
treef352f8c4fbd7721388fd9e6cf52755ae536d863f
parentec7780ebdab480139596c3cb08ee77d7035457b3
[ThinLTO] Fix empty .llvmcmd sections

When passing -lto-embed-bitcode=post-merge-pre-opt, we were getting
empty .llvmcmd sections. It turns out that is because the
CodeGenOptions::CmdArgs field was only populated when clang saw
-fembed-bitcode={all|marker}.

This patch always populates the CodeGenOptions::CmdArgs. The overhead
of carrying through in memory in all cases is likely negligible in
the grand schema of things, and it keeps the using code simple.

Differential Revision: https://reviews.llvm.org/D90366
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/thinlto_embed_bitcode.ll