[PATCH] D51314: Parse compile commands lazily in InterpolatingCompilationDatabase

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 28 01:39:56 PDT 2018


sammccall 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 {
----------------
ilya-biryukov wrote:
> 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.
I think the idea is "this comment just reiterates standard C++ semantics".

(FWIW I find the asserts hurt readability - it's unusual to try to detect this condition, and TraitsComputed is easily mistaken for a boolean)


Repository:
  rC Clang

https://reviews.llvm.org/D51314





More information about the cfe-commits mailing list