ilya-biryukov added inline comments.

================
Comment at: lib/Tooling/InterpolatingCompilationDatabase.cpp:201
+
+  CommandTraits computeTraits() const {
+    CommandTraits Result;
----------------
jfb wrote:
> It's not clear to me that this entire function is safe to call from multiple 
> threads at the same time. Even if it's safe now, I'm willing to bet it won't 
> always be that way. `getTraits` should therefore use a magic static or 
> `call_once` and avoid the headache entirely.
Thanks, `call_once` is both simpler and more reliable.


================
Comment at: lib/Tooling/InterpolatingCompilationDatabase.cpp:258
+  /// Null before Traits were computed, non-null otherwise. All accesses to 
this
+  /// must be atomic.
+  mutable std::shared_ptr<CommandTraits> Traits;
----------------
jfb wrote:
> The comment should say why accesses need to be atomic. Or better yet, this 
> should only be usable "the right way".
Clarified how it's used.


Repository:
  rC Clang

https://reviews.llvm.org/D51314



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to