[PATCH] D30668: Add llvm::sys::fs::real_path

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 15:44:45 PST 2017


rnk added inline comments.


================
Comment at: llvm/lib/Support/Unix/Path.inc:845
+  std::error_code EC;
+  if (S[0] == '~') {
+    // open() doesn't accept tilde expressions, they are expanded by the shell.
----------------
labath wrote:
> I am wondering whether the tilde expansion should not be controlled by an argument. As the comment says, tilde expansion is done at a completely different level than path canonicalization. `~` is a perfectly valid path component and it's not clear to me that every user of this function would want the magic tilde expansion behavior as well. I think that can create some confusion, as this is not the behavior of any of the standard utilities and functions elsewhere (`realpath` unix utility, `realpath` POSIX function, llvm's `openFileForRead`, ...). For that reason it may be safer for the caller to explicitly opt-in into this behavior.
Does the tilde expansion work on Windows? If not, let's leave it out like Pavel suggests.


https://reviews.llvm.org/D30668





More information about the llvm-commits mailing list