ilya-biryukov added subscribers: sammccall, klimek.
ilya-biryukov added a comment.

LG, just a few comments. Supporting compiler plugins in clangd is non-trivial 
and we don't support them so far, so filtering out the options make sense.

It feels these helper belong in the Tooling library, that would allow to reuse 
code between clang-tidy, clangd, etc. Could even be the default behavior, since 
most of the tools won't handle compiler plugins well, unless compiled with the 
same exact version of the compiler.
I'd be interested in what other people think, @sammccall, @klimek?



================
Comment at: clangd/ClangdUnit.cpp:429
+  const auto &CommandLine = Inputs.CompileCommand.CommandLine;
+  for (size_t I = 0, E = CommandLine.size(); I != E; I++) {
+    // According to https://clang.llvm.org/docs/ClangPlugins.html
----------------
ioeric wrote:
> This doesn't seem to be clangd specific; clang-tidy seems to have the same 
> issue. Could we share the filtering logic (e.g. in 
> lib/Tooling/ArgumentsAdjusters.cpp)?
We need a comment mentioning that we are filtering out the plugin options and 
why we're doing that here


================
Comment at: clangd/ClangdUnit.cpp:433
+    // <arbitrary-argument>
+    if (I + 4 < E && CommandLine[I] == "-Xclang" &&
+        (CommandLine[I + 1] == "-load" || CommandLine[I + 1] == "-plugin" ||
----------------
Maybe move this code into `ClangdServer::getCompileCommand` to keep **all** 
argument adjustments that we do in clangd in one place.
We add `-resource-dir` there.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56841



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

Reply via email to