[clangd] Really fix clang -Wimplicit-fallthrough
authorFangrui Song <maskray@google.com>
Fri, 2 Nov 2018 05:59:29 +0000 (05:59 +0000)
committerFangrui Song <maskray@google.com>
Fri, 2 Nov 2018 05:59:29 +0000 (05:59 +0000)
The intention was to fall through to Function case in LLVM_ENABLE_ASSERTIONS=Off builds.

Use #ifndef NDEBUG to fix -Wimplicit-fallthrough

llvm-svn: 345953

clang-tools-extra/clangd/CodeComplete.cpp

index 3bfde61..fec91e1 100644 (file)
@@ -218,8 +218,11 @@ struct CompletionCandidate {
       case index::SymbolKind::ClassMethod:
       case index::SymbolKind::InstanceMethod:
       case index::SymbolKind::StaticMethod:
-        assert(false && "Don't expect members from index in code completion");
+#ifndef NDEBUG
+        llvm_unreachable("Don't expect members from index in code completion");
+#else
         LLVM_FALLTHROUGH;
+#endif
       case index::SymbolKind::Function:
         // We can't group overloads together that need different #includes.
         // This could break #include insertion.