From efc0ed79a219887cf0b284ffc0058a37f0116f2a Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Wed, 27 Jan 2021 09:47:17 +0100 Subject: [PATCH] [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 --- lib/Testing/Support/Annotations.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Testing/Support/Annotations.cpp b/lib/Testing/Support/Annotations.cpp index 24607bd4c7d..44d3acccfdb 100644 --- a/lib/Testing/Support/Annotations.cpp +++ b/lib/Testing/Support/Annotations.cpp @@ -53,7 +53,8 @@ Annotations::Annotations(llvm::StringRef Text) { continue; } if (Text.consume_front("$")) { - Name = Text.take_while(llvm::isAlnum); + Name = + Text.take_while([](char C) { return llvm::isAlnum(C) || C == '_'; }); Text = Text.drop_front(Name->size()); continue; }