[PATCH] D34440: [Clang] Expand response files before loading compilation database

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 14 05:48:56 PDT 2017


alexfh added a comment.

In https://reviews.llvm.org/D34440#808156, @vladimir.plyashkun wrote:

> **To discuss:**
>  ...
>  By this moment, we unable to use //CompilationDatabase.json// from //CLion //side which is widely used in //Clang-Tidy// and in other common tools.


It would be interesting to learn more about the reasons why you can't use JSON compilation database. In case you don't want to clutter the project's directory, you can place the compile_commands.json file elsewhere (in a temporary directory, for example) and point clang tools to this directory using the `-p` command line flag.

> Anyway, there are possibility to pass compiler options directly through command line.
>  But we cannot pass compiler options directly through command-line, due to command-line-length restrictions.
>  So, we decided to pass compiler options through //@ResponseFile //mechanism.
>  But there are some problems with this approach.
>  Before this patch, ///clang/lib/Tooling/CommonOptionsParser.cpp// worked in this way:
> 
> 1. Load compilation database from command-line
> 2. Expand response files
> 3. Parse all other command line arguments I think it's strange behavior?

I don't think anyone has tried using response files for clang tools before. So the behavior here is almost certainly not intended. The other question is what would be a good way to handle response files in clang tools and whether we want it at all. IIUC, the only use case for response files is to workaround the limits on the size of a command line. If so, clang tools have an alternative solution - JSON compilation database. Are there any concerns using the alternative?


Repository:
  rL LLVM

https://reviews.llvm.org/D34440





More information about the cfe-commits mailing list