[PATCH] D49657: [clangd] Make SymbolLocation => bool conversion explicitly.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 1 04:24:32 PDT 2018


hokein marked an inline comment as done.
hokein added inline comments.


================
Comment at: clangd/index/Index.h:45
 
-  operator bool() const { return !FileURI.empty(); }
+  explicit operator bool() const { return !FileURI.empty(); }
+  bool operator==(const SymbolLocation& Loc) const {
----------------
ilya-biryukov wrote:
> Maybe we should go even further and replace this with an `isValid` method? Conversion ops are confusing.
I think making the bool operator explicit is sufficient to avoid the scary implicit-conversion problem. 


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49657





More information about the cfe-commits mailing list