jfb requested changes to this revision.
jfb added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/Tooling/InterpolatingCompilationDatabase.cpp:201
+
+  CommandTraits computeTraits() const {
+    CommandTraits Result;
----------------
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.


================
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;
----------------
The comment should say why accesses need to be atomic. Or better yet, this 
should only be usable "the right way".


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