Hashing the clang resource path

Argyrios Kyrtzidis via cfe-commits cfe-commits at lists.llvm.org
Mon May 1 16:14:51 PDT 2017


> On May 1, 2017, at 7:51 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> 
> I think we may have stumbled across a bug with
> CIndexer::getClangResourcesPath(), where on POSIX-y systems it uses
> dladdr() to get the path of the shared object. It seems that on some
> systems (in our case, OS X 10.6.8), dladdr() does not return a
> canonicalized path. We're getting a path like
> PATH/TO/CLANG/build/bin/../lib/clang/4.0.0. This resource directory
> path is then used to calculate a hash used by
> CompilerInvocation::getModuleHash(). This, in turn, is causing
> Index/pch-from-libclang.c to fail for us because the module cache
> paths have different names -- the first path is calculated with
> PATH/TO/CLANG/build/lib/clang/4.0.0 and the second path uses
> PATH/TO/CLANG/build/bin/../lib/clang/4.0.0.
> 
> Should CIndexer::getClangResourcePath() always return a canonicalized
> file path, or is it expected that it should return an unnormalized
> path and receivers of that path should be responsible for
> canonicalizing it?

I’d suggest that getClangResourcePath() should return 'PATH/TO/CLANG/build/lib/clang/4.0.0’ as well.

> 
> Thanks!
> 
> ~Aaron



More information about the cfe-commits mailing list