[PATCH] D146497: libclang: Pass Clang install directory to driver via argv[0].

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 22 15:11:51 PDT 2023


pcc added inline comments.


================
Comment at: clang/tools/libclang/CIndex.cpp:4022
+  llvm::sys::path::append(ClangPath, "bin");
+  llvm::sys::path::append(ClangPath, "clang");
+
----------------
pcc wrote:
> aaron.ballman wrote:
> > I suspect this doesn't matter *too* much, but... on Windows, wouldn't this be `clang.exe` instead? (This isn't new to your patch, so mostly wondering if there's a separate issue we should track.)
> I don't think it matters; the `Driver` class strips off the `bin/clang` part before storing it:
> https://github.com/llvm/llvm-project/blob/4d18d97b594ccaa3cbd79beb4afef45e4156dc8d/clang/lib/Driver/Driver.cpp#L211
> 
> Aside from that, the only user I could find that's reachable from this function is a rather obscure codegen feature:
> https://github.com/llvm/llvm-project/blob/fe27495be2040007c7b20844a9371b06156ab405/clang/lib/Frontend/CompilerInvocation.cpp#L4464
> and this API doesn't do codegen.
And of course I link to a line of code that stores the filename somewhere, contradicting what I wrote... that `Name` field, though, seems to be only used for crash reporting and a help message:

https://github.com/llvm/llvm-project/blob/4d18d97b594ccaa3cbd79beb4afef45e4156dc8d/clang/lib/Driver/Driver.cpp#L1516
https://github.com/llvm/llvm-project/blob/4d18d97b594ccaa3cbd79beb4afef45e4156dc8d/clang/lib/Driver/Driver.cpp#L1801
https://github.com/llvm/llvm-project/blob/4d18d97b594ccaa3cbd79beb4afef45e4156dc8d/clang/lib/Driver/Driver.cpp#L1931


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146497



More information about the cfe-commits mailing list