[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:25:12 PDT 2018


This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.
Closed by commit rCTE338517: [clangd] Make SymbolLocation => bool conversion explicitly. (authored by hokein, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D49657?vs=156723&id=158502#toc

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49657

Files:
  clangd/index/Index.h


Index: clangd/index/Index.h
===================================================================
--- clangd/index/Index.h
+++ clangd/index/Index.h
@@ -30,6 +30,9 @@
     uint32_t Line = 0; // 0-based
     // Using UTF-16 code units.
     uint32_t Column = 0; // 0-based
+    bool operator==(const Position& P) const {
+      return Line == P.Line && Column == P.Column;
+    }
   };
 
   // The URI of the source file where a symbol occurs.
@@ -39,7 +42,11 @@
   Position Start;
   Position End;
 
-  operator bool() const { return !FileURI.empty(); }
+  explicit operator bool() const { return !FileURI.empty(); }
+  bool operator==(const SymbolLocation& Loc) const {
+    return std::tie(FileURI, Start, End) ==
+           std::tie(Loc.FileURI, Loc.Start, Loc.End);
+  }
 };
 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const SymbolLocation &);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49657.158502.patch
Type: text/x-patch
Size: 856 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180801/5c2839b4/attachment-0001.bin>


More information about the cfe-commits mailing list