[PATCH] D130620: Fix lack of cc1 flag in llvmcmd sections when assertions are enabled

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 28 13:00:02 PDT 2022


jansvoboda11 added a comment.

Thanks for adding the tests. They are failing in CI though, and I don't think they're entirely correct.

My understanding is that the goal is to make sure Clang doesn't drop the `-cc1` flag when embedding command-lines into object files.

During normal compilation, the arguments given by the driver to `CompilerInvocation::CreateFromArgs()` already begin with `-cc1`, so I suggest setting up the tests to do so as well. We could use `{"-cc1", "-round-trip-args"}` in the first test case and `{"-cc1", "-no-round-trip-args"}` in the second.

We probably want to verify that the `CompilerInvocation` member used to store the command-line looks correctly. My guess is that the bitcode is using `CodeGenOptions::CommandLineArgs`, so I suggest checking that instead of `GeneratedArgs` in the final assertion.

(I feel like `GeneratedArgs` are an implementation detail in this particular test case. Moreover, the vector will be empty in the current revision, since you don't call `Invocation.generateCC1CommandLine(GeneratedArgs, *this)` like the surrounding test cases do.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130620/new/

https://reviews.llvm.org/D130620



More information about the cfe-commits mailing list