ilya-biryukov added inline comments.

================
Comment at: lib/Tooling/InterpolatingCompilationDatabase.cpp:124
+// A CompileCommand that can be applied to another file. Any instance of this
+// object is invalid after std::move() from it.
 struct TransferableCommand {
----------------
jfb wrote:
> This comment about `move` isn't really saying anything. Also, it's valid but 
> unspecified (in the case of STL things). I'd drop it.
We specifically assert that object cannot be called after `move()` (check the 
unique_ptr that stores our `once_flag`). It's definitely undefined behavior to 
call any methods, because they will immediately dereference a null pointer (the 
aforementioned unique_ptr).

Happy to drop the comment, though, we do have asserts for that.


================
Comment at: lib/Tooling/InterpolatingCompilationDatabase.cpp:128
+      : OriginalCmd(std::move(C)),
+        TraitsComputed(llvm::make_unique<std::once_flag>()) {}
 
----------------
jfb wrote:
> The `once_flag` should just be a static, don't allocate it.
Sorry, I don't seem to follow. We need one `once_flag` per `TransferableCommand`


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