vladimir.plyashkun added a comment.

**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.



================
Comment at: unittests/Tooling/CommonOptionsParserTest.cpp:41
+  ~CommonOptionsParserTest() override {
+    llvm::sys::fs::remove(ResponseFileName);
+    llvm::sys::fs::remove(TestDir);
----------------
I moved test-cases to separate file.
But as i mentioned before, i don't see any options how to use VFS here.
All other test-cases related with response files expansion also don't use VFS 
for some reasons, e.g. `unittests/Support/CommandLineTest.cpp`


Repository:
  rL LLVM

https://reviews.llvm.org/D34440



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to