[all-commits] [llvm/llvm-project] dd8fb2: [clangd] Implement semanticTokens modifiers

Sam McCall via All-commits all-commits at lists.llvm.org
Tue Feb 9 07:35:21 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dd8fb21227cef26b1cdd44792a1ee77910afd86a
      https://github.com/llvm/llvm-project/commit/dd8fb21227cef26b1cdd44792a1ee77910afd86a
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2021-02-09 (Tue, 09 Feb 2021)

  Changed paths:
    M clang-tools-extra/clangd/ClangdLSPServer.cpp
    M clang-tools-extra/clangd/SemanticHighlighting.cpp
    M clang-tools-extra/clangd/SemanticHighlighting.h
    M clang-tools-extra/clangd/refactor/tweaks/AnnotateHighlightings.cpp
    M clang-tools-extra/clangd/test/initialize-params.test
    M clang-tools-extra/clangd/test/semantic-tokens.test
    M clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
    M clang-tools-extra/clangd/unittests/tweaks/AnnotateHighlightingsTests.cpp
    M llvm/lib/Testing/Support/Annotations.cpp

  Log Message:
  -----------
  [clangd] Implement semanticTokens modifiers

- Infrastructure to support modifiers (protocol etc)
- standard modifiers:
  - declaration (but no definition, yet)
  - deprecated
  - readonly (based on a fairly fuzzy const checking)
  - static (for class members and locals, but *not* file-scope things!)
  - abstract (for C++ classes, and pure-virtual methods)
- nonstandard modifier:
  - deduced (on "auto" whose Kind is Class etc)
    Happy to drop this if it's controversial at all.
- While here, update sample tweak to use our internal names, in
  anticipation of theia TM scopes going away.

This addresses some of the goals of D77702, but leaves some things undone.
Mostly because I think these will want some discussion.
 - no split between dependent type/name.
   (We may want to model this as a modifier, type+dependent vs ???+dependent)
 - no split between primitive/typedef.
   (Is introducing a nonstandard kind is worth this distinction?)
 - no nonstandard local attribute
   This probably makes sense, I'm wondering if we want others and how
   they fit together.

There's one minor regression in explicit template specialization declarations
due to a latent bug in findExplicitReferences, but fixing it after seems OK.

Differential Revision: https://reviews.llvm.org/D77811




More information about the All-commits mailing list