[PATCH] D34290: [Driver] Do a PATH lookup when using only program name with -no-canonical-prefixes

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 16 14:38:03 PDT 2017


phosek added inline comments.


================
Comment at: tools/driver/driver.cpp:58
+    SmallString<128> ExecutablePath(Argv0);
+    // Do a PATH lookup, if there are no directory components.
+    if (llvm::sys::path::filename(ExecutablePath) == ExecutablePath)
----------------
hans wrote:
> What if "clang" is in the current directory? Presumably that should then be preferred over PATH.. will we get that right with this patch?
> 
> Another way would be to check access() on Argv0, which is what we do when trying to execute anyway. Is there any downside to that?
I don't think there should be any downside to that approach.


Repository:
  rL LLVM

https://reviews.llvm.org/D34290





More information about the cfe-commits mailing list