[PATCH] D40983: Generate Libclang invocation reproducers using a new -cc1gen-reproducer option

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 21 13:22:16 PST 2017

arphaman marked 2 inline comments as done.
arphaman added a comment.

In https://reviews.llvm.org/D40983#958809, @bruno wrote:

> Hi Alex,
> Thanks for improving this.
> - Instead of adding `-cc1gen-reproducer`, why can't you run that through `-cc1` and have a flag similar to `-###`, which just prints the reproducer line?

It would be difficult to add this logic to the regular `-cc1`, as it would need to construct a real compiler invocation on top of the pseudo one which takes the libclang invocation file (because it has to load the actual compiler arguments from the libclang file). This would be difficult and quite disruptive to the code in the cc1 driver and the compiler invocation. The approach in this patch is much simpler to implement and maintain, and does not disrupt the code in the `cc1` driver. This patch makes it more of a tool rather than a clang driver invocation.

> - I didn't  understand how you can use the final output information, can you give an example to illustrate?

Given a sample output like:


The tool's client (also a libclang client) will parse the JSON object with the files that make up the reproducer. It will then be able to do whatever it needs with those specific files.

Comment at: include/clang/Driver/Driver.h:394
+  struct CompilationDiagnosticReport {
+    std::vector<std::string> TemporaryFiles;
+  };
bruno wrote:
> I assume the number of temporary files are usually small, can you switch to SmallVector here?

  rC Clang


More information about the cfe-commits mailing list