[clang-tools-extra] r345953 - [clangd] Really fix clang -Wimplicit-fallthrough

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 1 22:59:30 PDT 2018


Author: maskray
Date: Thu Nov  1 22:59:29 2018
New Revision: 345953

URL: http://llvm.org/viewvc/llvm-project?rev=345953&view=rev
Log:
[clangd] Really fix clang -Wimplicit-fallthrough

The intention was to fall through to Function case in LLVM_ENABLE_ASSERTIONS=Off builds.

Use #ifndef NDEBUG to fix -Wimplicit-fallthrough

Modified:
    clang-tools-extra/trunk/clangd/CodeComplete.cpp

Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=345953&r1=345952&r2=345953&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original)
+++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Thu Nov  1 22:59:29 2018
@@ -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.




More information about the cfe-commits mailing list