[PATCH] D67277: [clangd] Replace HighlightingKind::NumKinds with LastKind. NFC
    Phabricator via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Sep  9 01:57:24 PDT 2019
    
    
  
This revision was automatically updated to reflect the committed changes.
Closed by commit rL371375: [clangd] Replace HighlightingKind::NumKinds with LastKind. NFC (authored by ibiryukov, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
  https://reviews.llvm.org/D67277?vs=219102&id=219296#toc
Repository:
  rL LLVM
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67277/new/
https://reviews.llvm.org/D67277
Files:
  clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
  clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp
  clang-tools-extra/trunk/clangd/SemanticHighlighting.h
Index: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
@@ -87,7 +87,7 @@
 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;
Index: clang-tools-extra/trunk/clangd/SemanticHighlighting.h
===================================================================
--- clang-tools-extra/trunk/clangd/SemanticHighlighting.h
+++ clang-tools-extra/trunk/clangd/SemanticHighlighting.h
@@ -41,7 +41,7 @@
   Primitive,
   Macro,
 
-  NumKinds,
+  LastKind = Macro
 };
 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, HighlightingKind K);
 
Index: clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp
@@ -383,9 +383,8 @@
     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 @@
     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");
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67277.219296.patch
Type: text/x-patch
Size: 1962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190909/9073ae84/attachment.bin>
    
    
More information about the llvm-commits
mailing list