[clang-tools-extra] Symbol tags in SymbolInformation, WorkspaceSymbol, CallHierarchyItem and TypeHierarchyItem (PR #170103)
Dimitri Ratz via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 27 05:40:58 PDT 2026
================
@@ -17,20 +17,108 @@
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/StringSaver.h"
+#include <limits>
+#include <type_traits>
namespace clang {
namespace clangd {
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
-/// A bitmask type representing symbol tags supported by LSP.
-/// \see
-/// https://microsoft.github.io/language-server-protocol/specifications/specification-current/#symbolTag
-using SymbolTags = uint32_t;
-/// Ensure we have enough bits to represent all SymbolTag values.
-static_assert(static_cast<unsigned>(SymbolTag::LastTag) < 32,
- "Too many SymbolTags to fit in uint32_t. Change to uint64_t if "
- "we ever have more than 32 tags.");
+/// Type-safe bitset for SymbolTag values.
+///
+/// - The storage type adapts to SymbolTag's underlying type.
+/// - Bits outside the supported [FirstTag..LastTag] range are dropped.
+class SymbolTags {
----------------
ratzdi wrote:
Without going into a detailed analysis of this comment, I agree with you, I would prefer the simplicity too.
https://github.com/llvm/llvm-project/pull/170103
More information about the cfe-commits
mailing list