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

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 14 01:27:54 PDT 2017


klimek added a comment.

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

> **To discuss:**
>  This patch is required for correct integration //Clang-Tidy// with //CLion IDE//.
>  By this moment, we unable to use //CompilationDatabase.json// from //CLion //side which is widely used in //Clang-Tidy// and in other common tools.
>  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? Why we try to load compilation database first? Maybe it's better to expand response files and only after that try to load compilation database and parse another options? It's hard to refactor //cl::ParseCommandLineOptions// and //cl::ExpandResponseFiles// functions, due to high number of usages, so i copied some block directly into ///clang/lib/Tooling/CommonOptionsParser.cpp// I don't think that is a best solution, but i don't have another one.


I don't fully understand the problem yet, especially what you mean with "expand response files first".
Generally, the fixed-compilation-db mechanism is there so you can pass a single command line that will be used by all translation units - the response files in that command line would be expanded each time we run a tool on some TU. That seems in line with the design.
Can you post an example of what you're trying to do and what error message you get?


Repository:
  rL LLVM

https://reviews.llvm.org/D34440





More information about the cfe-commits mailing list