ilya-biryukov added inline comments.
================
Comment at: clangd/index/CanonicalIncludes.cpp:21
llvm::StringRef CanonicalPath) {
addRegexMapping((llvm::Twine("^") + llvm::Regex::escape(Path) + "$").str(),
CanonicalPath);
----------------
ilya-biryukov wrote:
> Technically, if one thread initializes `CanonicalIncludes` and the other
> thread reads from it, this is a data race.
> Maybe we're ok with our current usage, but I don't have enough confidence in
> that (i.e. don't know C++'s memory model good enough) and would advice to
> take the lock in other functions of `CanonicalIncludes` too.
>
As Sam pointed out, it's fine the way it is right now. We don't want any
thread-safety guarantees from the non-const methods of the class.
But could you please add a comment to the class that non-const methods of it
are not thread-safe even though it has a `mutex` inside?
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D43462
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits