mstorsjo added a comment.

In D141206#4037160 <https://reviews.llvm.org/D141206#4037160>, @alvinhochun 
wrote:

> The idea sounds reasonable. I don't know mingw-w64 toolchains well enough, 
> but I'll try:
>
> How does it interact with the following conditions (lines 469-475)? They look 
> like they may be looking for a mingw-w64 sysroot, which may be ignored by the 
> new check.
>
>   else if (llvm::ErrorOr<std::string> TargetSubdir = findClangRelativeSysroot(
>                getDriver(), LiteralTriple, getTriple(), SubdirName))
>     Base = std::string(llvm::sys::path::parent_path(TargetSubdir.get()));
>   else if (llvm::ErrorOr<std::string> GPPName =
>                findGcc(LiteralTriple, getTriple()))
>     Base = std::string(llvm::sys::path::parent_path(
>         llvm::sys::path::parent_path(GPPName.get())));

Thanks for having a look!

Those cases are taken into account here; for the case of 
`findClangRelativeSysroot`, if clang is executing in e.g. 
`<somewhere>/llvm-mingw/bin/clang` and it finds 
`<somewhere>/llvm-mingw/x86_64-w64-mingw32`, then it doesn't pick that as 
`<base>`, but it picks `<somewhere>/llvm-mingw`, and gets the 
`x86_64-w64-mingw32` subdir prefix included via the `SubdirName` variable.

Likewise, if `findClangRelativeSysroot` failed, but `findGcc` found 
`/usr/bin/x86_64-w64-mingw32-gcc` in `$PATH`, then it also picks `/usr` as 
`<base>` (which is needed for finding libgcc things under `<base>/lib/gcc`).

So for these reasons, the search can't stay entirely within `<base>/<target 
triple>` - and we may want to skip `<base>/include` and `<base>/lib` when we 
believe that's meant for a different target.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141206

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

Reply via email to