MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.78k stars 260 forks source link

Compatibility Issue: llvm::is_contained with std::initializer_list in ccls/src/message_handler.cc Fails on LLVM 10–14 #975

Closed adghadmin closed 3 weeks ago

adghadmin commented 3 weeks ago

Observed behavior

When building ccls with LLVM versions 10 to 14(I believe this also applies to v<10), the following compilation error occurs in ccls/src/message_handler.cc due to unsupported usage of llvm::is_contained with std::initializer_list: /ccls/src/message_handler.cc: In member function ‘void ccls::MessageHandler::textDocument_semanticTokensRange(ccls::SemanticTokensRangeParams&, ccls::ReplyOnce&)’: /ccls/src/message_handler.cc:548:39: error: no matching function for call to ‘is_contained(<brace-enclosed initializer list>, ccls::SymbolKind&)’ This error occurs because llvm::is_contained with std::initializer_list is only available from LLVM 15 onward. llvm::is_contained with std::initializer_list is introduced in the latest commit Support LSP semantic tokens

MaskRay commented 3 weeks ago

Thanks for reporting! I just rewrote the commit to add a llvm::is_contained fallback for LLVM<15

The new overload is from https://reviews.llvm.org/D122079