Hashing the clang resource path

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon May 1 07:51:57 PDT 2017


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?

Thanks!

~Aaron


More information about the cfe-commits mailing list