[PATCH] D90397: [clangd] Value initialize SymbolIDs

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 29 08:10:17 PDT 2020


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/index/SymbolID.h:57
 
+  bool isValid() const { return HashValue != std::array<uint8_t, RawSize>{}; }
+
----------------
I'm not a big fan of LLVM's habit of calling the sentinel value "invalid".

Consider SourceLocation - one can construct invalid source locations that are `isValid()` (add an offset longer than the file) and SourceLocation() most commonly means "there is no location associated" rather than "we have bad data".

WDYT about calling this "isNull" (and possibly defining operator bool())?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90397/new/

https://reviews.llvm.org/D90397



More information about the cfe-commits mailing list