[clangd] Replace HighlightingKind::NumKinds with LastKind. NFC

Summary:
The latter simplifies the client code by avoiding the need to handle it
as a separate case statement.

Reviewers: hokein

Reviewed By: hokein

Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 371375
This commit is contained in:
Ilya Biryukov 2019-09-09 08:57:17 +00:00
parent 6b9aedaec6
commit 63d5d16237
3 changed files with 3 additions and 6 deletions

View File

@ -87,7 +87,7 @@ CompletionItemKindBitset defaultCompletionItemKinds() {
std::vector<std::vector<std::string>> buildHighlightScopeLookupTable() {
std::vector<std::vector<std::string>> LookupTable;
// HighlightingKind is using as the index.
for (int KindValue = 0; KindValue < (int)HighlightingKind::NumKinds;
for (int KindValue = 0; KindValue <= (int)HighlightingKind::LastKind;
++KindValue)
LookupTable.push_back({toTextMateScope((HighlightingKind)(KindValue))});
return LookupTable;

View File

@ -383,9 +383,8 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, HighlightingKind K) {
return OS << "Primitive";
case HighlightingKind::Macro:
return OS << "Macro";
case HighlightingKind::NumKinds:
llvm_unreachable("NumKinds is not a valid HighlightingKind");
}
llvm_unreachable("invalid HighlightingKind");
}
std::vector<LineHighlightings>
@ -511,8 +510,6 @@ llvm::StringRef toTextMateScope(HighlightingKind Kind) {
return "storage.type.primitive.cpp";
case HighlightingKind::Macro:
return "entity.name.function.preprocessor.cpp";
case HighlightingKind::NumKinds:
llvm_unreachable("must not pass NumKinds to the function");
}
llvm_unreachable("unhandled HighlightingKind");
}

View File

@ -41,7 +41,7 @@ enum class HighlightingKind {
Primitive,
Macro,
NumKinds,
LastKind = Macro
};
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, HighlightingKind K);