[PATCH] D63194: [clangd] Link in target infos and pass target and mode while invoking driver

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 06:42:36 PDT 2019


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/GlobalCompilationDatabase.cpp:36
   Cmd.CommandLine = ArgsAdjuster(Cmd.CommandLine, Cmd.Filename);
+  tooling::addTargetAndModeForProgramName(Cmd.CommandLine, Cmd.CommandLine[0]);
   // Inject the resource dir.
----------------
ilya-biryukov wrote:
> Do we actually need this if we provide a proper `Argv[0]` to the driver?
> My understanding is that the driver should figure out the targets from custom binary names on its own.
unfortunately yes. 

because if the "-target" is missing, driver tries to deduce it from the "running binary" which is "clangd" in our case.


================
Comment at: clang-tools-extra/clangd/test/target_info.test:8
+# (with the extra slash in the front), so we add it here.
+# RUN: sed -e "s|file://\([A-Z]\):/|file:///\1:/|g" %t.test.1 > %t.test
+
----------------
ilya-biryukov wrote:
> This is added unconditionally on all platforms, right?
> Why not just add this extra slash directly into the input file?
no it is not, this checks whether we have a drive letter in the file uri ("[A-Z]:") and adds the slash in that case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63194





More information about the cfe-commits mailing list