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

Context here, this patch is over a year old and predates the work on 
heuristically picking a compile command from another file in the CDB.

I don't think anyone has concrete plans to revive this, the heuristics work 
well enough and often enough. I should probably have abandoned this patch, 
sorry for the time lost in detailed comments.

However there's certainly some value in indexing the include graph and/or 
determining main-file/header pairs.
e.g. to improve switchsourceheader, to enable cross-file refactorings like 
"out-line implementation". And maybe to improve compile command accuracy too.

This patch was pretty narrowly tailored at getting compile commands quickly, if 
we developed this approach it should probably be more general purpose, part of 
the index, and maybe take symbol declaration/definition into account rather 
than just #includes.



================
Comment at: clangd/IncludeScanner.cpp:131
+  IgnoringDiagConsumer IgnoreDiags;
+  // XXX the VFS working directory is global state, this is unsafe.
+  Cmd.VFS->setCurrentWorkingDirectory(Cmd.Directory);
----------------
klimek wrote:
> I assume that's a note to you that you want to change this?
This has since been fixed, it's no longer global state :-)


================
Comment at: clangd/IncludeScanner.cpp:159
+  // When reusing flags, we add an explicit `-x cpp` to override the extension.
+  // TODO: copying CompilerInvocation would avoid this, and is more robust.
+  if (std::find(Cmd.CommandLine.begin(), Cmd.CommandLine.end(), "-x") ==
----------------
klimek wrote:
> Wondering why we can't use one of the tooling abstractions here...
As far as I can tell, the only abstraction Tooling offers here is 
CompileCommand, the only way to robustly manipulate it is through the Driver 
(the semantics here are too subtle for brute-force string manipulation). 
InterpolatingCompilationDatabase does this, but doesn't expose the primitives 
publicly. It could if there was a need.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D41911



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

Reply via email to