[PATCH] D79842: [clang][Driver] Correct tool search path priority

David Spickett via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 13 03:11:40 PDT 2020


DavidSpickett created this revision.
DavidSpickett added reviewers: rogfer01, ddunbar, chandlerc.
Herald added subscribers: cfe-commits, kristof.beyls.
Herald added a project: clang.
DavidSpickett marked an inline comment as done.
DavidSpickett added inline comments.


================
Comment at: clang/test/Driver/program-path-priority.c:72
+// <default-triple>-gcc has lowest priority
+// RUN: default_triple=$(%t/clang --version | grep -oP "(?<=Target:\s).*")
+// RUN: touch %t/${default_triple}-gcc
----------------
Pretty sure I'm stretching the limits here, probably not suitable for Windows. I hoped to be able to capture the default triple in a CHECK line, then use it in a following RUN line. (though thinking about how FileCheck works, that isn't possible)


As seen in:
https://bugs.llvm.org/show_bug.cgi?id=45693

When clang looks for a tool it has a set of
possible names for it, in priority order.
Previously it would look for these names in
the program path. Then look for all the names
in the PATH.

This means that aarch64-none-elf-gcc on the PATH
would lose to gcc in the program path.
(which was /usr/bin in the bug's case)

This changes that logic to search each name in both
possible locations, then move to the next name.
Which is more what you would expect to happen when
using a non default triple.

(-B prefixes maybe should follow this logic too,
but are not changed in this patch)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79842

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/program-path-priority.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79842.263650.patch
Type: text/x-patch
Size: 7636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200513/58e4517c/attachment.bin>


More information about the cfe-commits mailing list