Hi,
I’ve found a potential race condition that can happen in the following code on variable ResourcesPath in tools/libclang/CIndexer.cpp
const std::string &CIndexer::getClangResourcesPath() {
// Did we already compute the path?
if (!ResourcesPath.empty())
return ResourcesPath;
SmallString<128> LibClangPath;
…
// Cache our result.
ResourcesPath = LibClangPath.str();
return ResourcesPath;
}
Variable ResourcesPath isn’t synchronized on so it’s possible that another thread might update ResourcesPath at the same time. Is it worth fixing this or is libclang advertised as not thread-safe so it’s not worth fixing these types of bugs ?
Thanks,
Ranjeet