[PATCH] D33788: Return a canonical path from getClangResourcePath()

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 2 11:39:19 PDT 2017


aaron.ballman added a comment.

In https://reviews.llvm.org/D33788#771671, @bruno wrote:

> > I'm unaware of any other API that canonicalizes the path, which is what users of this API are going to expect.
>
> You can also call `sys::path::remove_dots(Path, /*remove_dot_dot=*/true);`


Yes, but that does not canonicalize the path. For instance, it won't handle doubled-up slashes or symlinks.

Ultimately, the value returned from this API gets passed to POSIX functions which expect a canonical path. I don't think `remove_dots()` is sufficient. It should do the same thing as `getMainExecutable()`, I believe.

> 
> 
>> There's already a test case that covers this: Index/pch-from-libclang.c -- it was failing on OS X 10.6 for us. If you have a better test case in mind, I can certainly add it.
> 
> Works for me.




https://reviews.llvm.org/D33788





More information about the cfe-commits mailing list