[PATCH] D38425: [clangd] Document highlights for clangd

Marc-Andre Laperle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 23 10:26:14 PST 2017


malaperle added inline comments.


================
Comment at: clangd/ClangdUnit.cpp:997
+      DocumentHighlightKind Kind;
+      switch (Roles) {
+      case (unsigned)index::SymbolRole::Read:
----------------
With this code, I always get "text" kind. It's because index::SymbolRoleSet is a bitfield so you have to check the write, read bits. Something like:

    DocumentHighlightKind Kind = DocumentHighlightKind::Text;
    if (static_cast<index::SymbolRoleSet>(index::SymbolRole::Write) & Roles) {
      Kind = DocumentHighlightKind::Write;
    } else if (static_cast<index::SymbolRoleSet>(index::SymbolRole::Read) & Roles) {
      Kind = DocumentHighlightKind::Read;
    }


https://reviews.llvm.org/D38425





More information about the cfe-commits mailing list