commit ccls for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ccls for openSUSE:Factory checked in at 2022-08-01 21:32:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ccls (Old) and /work/SRC/openSUSE:Factory/.ccls.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ccls" Mon Aug 1 21:32:28 2022 rev:16 rq:991817 version:0.20220729 Changes: -------- --- /work/SRC/openSUSE:Factory/ccls/ccls.changes 2022-06-07 11:45:09.395232560 +0200 +++ /work/SRC/openSUSE:Factory/.ccls.new.1533/ccls.changes 2022-08-01 21:33:16.578151761 +0200 @@ -1,0 +2,9 @@ +Sat Jul 30 11:25:52 UTC 2022 - Aaron Puchert <aaronpuchert@alice-dsl.net> + +- Update to version 0.20220729. +- Drop obsolete patches: + * llvm14-braced-constructor-call.patch + * llvm14-include-STLExtras.patch + * llvm14-refactor-isIdentifierBody.patch + +------------------------------------------------------------------- Old: ---- ccls-0.20210330.tar.gz llvm14-braced-constructor-call.patch llvm14-include-STLExtras.patch llvm14-refactor-isIdentifierBody.patch New: ---- ccls-0.20220729.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ccls.spec ++++++ --- /var/tmp/diff_new_pack.cZ2HmI/_old 2022-08-01 21:33:17.162153436 +0200 +++ /var/tmp/diff_new_pack.cZ2HmI/_new 2022-08-01 21:33:17.166153448 +0200 @@ -17,7 +17,7 @@ Name: ccls -Version: 0.20210330 +Version: 0.20220729 Release: 0 Summary: C/C++/ObjC language server # main package is Apache 2.0 @@ -26,9 +26,6 @@ Group: Development/Tools/IDE URL: https://github.com/MaskRay/ccls Source0: %{URL}/archive/%{version}/%{name}-%{version}.tar.gz -Patch0: https://github.com/MaskRay/ccls/commit/3ce756e39ae48204f016a58684652ad62b4dd... -Patch1: https://github.com/MaskRay/ccls/commit/8422f0a522b6fbcb4412a8ec73d80b4acbc7e... -Patch2: https://github.com/MaskRay/ccls/commit/790daca4b2d9d5873623fee86283cd61212df... BuildRequires: clang-devel >= 7.0 BuildRequires: cmake >= 3.8 BuildRequires: llvm-devel >= 7.0 ++++++ ccls-0.20210330.tar.gz -> ccls-0.20220729.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/CMakeLists.txt new/ccls-0.20220729/CMakeLists.txt --- old/ccls-0.20210330/CMakeLists.txt 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/CMakeLists.txt 2022-04-17 07:29:03.000000000 +0200 @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(ccls LANGUAGES CXX) +project(ccls LANGUAGES CXX C) option(USE_SYSTEM_RAPIDJSON "Use system RapidJSON instead of the git submodule if exists" ON) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/README.md new/ccls-0.20220729/README.md --- old/ccls-0.20210330/README.md 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/README.md 2022-04-17 07:29:03.000000000 +0200 @@ -1,6 +1,6 @@ # ccls -[![Telegram](https://img.shields.io/badge/telegram-@cclsp-blue.svg)](https://telegram.me/cclsp) +[![Telegram](https://img.shields.io/badge/telegram-@cclsp-blue.svg)](https://telegram.me/ccls_lsp) [![Gitter](https://img.shields.io/badge/gitter-ccls--project-blue.svg?logo=gitter-white)](https://gitter.im/ccls-project/ccls) ccls, which originates from [cquery](https://github.com/cquery-project/cquery), is a C/C++/Objective-C language server. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/clang_tu.hh new/ccls-0.20220729/src/clang_tu.hh --- old/ccls-0.20210330/src/clang_tu.hh 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/clang_tu.hh 2022-04-17 07:29:03.000000000 +0200 @@ -17,6 +17,10 @@ } #endif +#if LLVM_VERSION_MAJOR < 14 // llvmorg-14-init-3863-g601102d282d5 +#define isAsciiIdentifierContinue isIdentifierBody +#endif + namespace ccls { std::string pathFromFileEntry(const clang::FileEntry &file); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/indexer.cc new/ccls-0.20220729/src/indexer.cc --- old/ccls-0.20210330/src/indexer.cc 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/indexer.cc 2022-04-17 07:29:03.000000000 +0200 @@ -527,8 +527,8 @@ auto i = name.find(short_name); if (short_name.size()) while (i != std::string::npos && - ((i && isIdentifierBody(name[i - 1])) || - isIdentifierBody(name[i + short_name.size()]))) + ((i && isAsciiIdentifierContinue(name[i - 1])) || + isAsciiIdentifierContinue(name[i + short_name.size()]))) i = name.find(short_name, i + short_name.size()); if (i == std::string::npos) { // e.g. operator type-parameter-1 @@ -552,7 +552,7 @@ paren++; else if (name[i - 1] == '(') paren--; - else if (!(paren > 0 || isIdentifierBody(name[i - 1]) || + else if (!(paren > 0 || isAsciiIdentifierContinue(name[i - 1]) || name[i - 1] == ':')) break; } @@ -1096,10 +1096,18 @@ } void InclusionDirective(SourceLocation hashLoc, const Token &tok, StringRef included, bool isAngled, - CharSourceRange filenameRange, const FileEntry *file, + CharSourceRange filenameRange, +#if LLVM_VERSION_MAJOR >= 15 // llvmorg-15-init-7692-gd79ad2f1dbc2 + llvm::Optional<FileEntryRef> fileRef, +#else + const FileEntry *file, +#endif StringRef searchPath, StringRef relativePath, const Module *imported, SrcMgr::CharacteristicKind fileType) override { +#if LLVM_VERSION_MAJOR >= 15 // llvmorg-15-init-7692-gd79ad2f1dbc2 + const FileEntry *file = fileRef ? &fileRef->getFileEntry() : nullptr; +#endif if (!file) return; auto spell = fromCharSourceRange(sm, param.ctx->getLangOpts(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/messages/initialize.cc new/ccls-0.20220729/src/messages/initialize.cc --- old/ccls-0.20210330/src/messages/initialize.cc 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/messages/initialize.cc 2022-04-17 07:29:03.000000000 +0200 @@ -226,9 +226,10 @@ const char *name = "ccls"; const char *version = CCLS_VERSION; } serverInfo; + const char *offsetEncoding = "utf-32"; }; REFLECT_STRUCT(InitializeResult::ServerInfo, name, version); -REFLECT_STRUCT(InitializeResult, capabilities, serverInfo); +REFLECT_STRUCT(InitializeResult, capabilities, serverInfo, offsetEncoding); struct FileSystemWatcher { std::string globPattern = "**/*"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/messages/textDocument_document.cc new/ccls-0.20220729/src/messages/textDocument_document.cc --- old/ccls-0.20210330/src/messages/textDocument_document.cc 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/messages/textDocument_document.cc 2022-04-17 07:29:03.000000000 +0200 @@ -128,16 +128,6 @@ template <> bool ignore(const QueryVar::Def *def) { return !def || def->is_local(); } - -void uniquify(std::vector<std::unique_ptr<DocumentSymbol>> &cs) { - std::sort(cs.begin(), cs.end(), - [](auto &l, auto &r) { return l->range < r->range; }); - cs.erase(std::unique(cs.begin(), cs.end(), - [](auto &l, auto &r) { return l->range == r->range; }), - cs.end()); - for (auto &c : cs) - uniquify(c->children); -} } // namespace void MessageHandler::textDocument_documentSymbol(JsonReader &reader, @@ -165,89 +155,58 @@ std::sort(result.begin(), result.end()); reply(result); } else if (g_config->client.hierarchicalDocumentSymbolSupport) { - std::unordered_map<SymbolIdx, std::unique_ptr<DocumentSymbol>> sym2ds; - std::vector<std::pair<std::vector<const void *>, DocumentSymbol *>> funcs, - types; - for (auto [sym, refcnt] : file->symbol2refcnt) { - if (refcnt <= 0 || !sym.extent.valid()) - continue; - auto r = sym2ds.try_emplace(SymbolIdx{sym.usr, sym.kind}); - auto &ds = r.first->second; - if (!ds || sym.role & Role::Definition) { - if (!ds) - ds = std::make_unique<DocumentSymbol>(); - if (auto range = getLsRange(wf, sym.range)) { - ds->selectionRange = *range; - ds->range = ds->selectionRange; - // For a macro expansion, M(name), we may use `M` for extent and - // `name` for spell, do the check as selectionRange must be a subrange - // of range. - if (sym.extent.valid()) - if (auto range1 = getLsRange(wf, sym.extent); - range1 && range1->includes(*range)) - ds->range = *range1; - } + std::vector<ExtentRef> syms; + syms.reserve(file->symbol2refcnt.size()); + for (auto [sym, refcnt] : file->symbol2refcnt) + if (refcnt > 0 && sym.extent.valid()) + syms.push_back(sym); + // Global variables `int i, j, k;` have the same extent.start. Sort them by + // range.start instead. In case of a tie, prioritize the widest ExtentRef. + std::sort(syms.begin(), syms.end(), + [](const ExtentRef &lhs, const ExtentRef &rhs) { + return std::tie(lhs.range.start, rhs.extent.end) < + std::tie(rhs.range.start, lhs.extent.end); + }); + + std::vector<std::unique_ptr<DocumentSymbol>> res; + std::vector<DocumentSymbol *> scopes; + for (ExtentRef sym : syms) { + auto ds = std::make_unique<DocumentSymbol>(); + if (auto range = getLsRange(wf, sym.range)) { + ds->selectionRange = *range; + ds->range = ds->selectionRange; + // For a macro expansion, M(name), we may use `M` for extent and + // `name` for spell, do the check as selectionRange must be a subrange + // of range. + if (sym.extent.valid()) + if (auto range1 = getLsRange(wf, sym.extent); + range1 && range1->includes(*range)) + ds->range = *range1; } - if (!r.second) - continue; - std::vector<const void *> def_ptrs; - SymbolKind kind = SymbolKind::Unknown; withEntity(db, sym, [&](const auto &entity) { - auto *def = entity.anyDef(); + const auto *def = entity.anyDef(); if (!def) return; ds->name = def->name(false); ds->detail = def->detailed_name; - for (auto &def : entity.def) - if (def.file_id == file_id && !ignore(&def)) { - kind = ds->kind = def.kind; - def_ptrs.push_back(&def); - } - }); - if (def_ptrs.empty() || !(kind == SymbolKind::Namespace || allows(sym))) { - ds.reset(); - continue; - } - if (sym.kind == Kind::Func) - funcs.emplace_back(std::move(def_ptrs), ds.get()); - else if (sym.kind == Kind::Type) - types.emplace_back(std::move(def_ptrs), ds.get()); - } + ds->kind = def->kind; - for (auto &[def_ptrs, ds] : funcs) - for (const void *def_ptr : def_ptrs) - for (Usr usr1 : ((const QueryFunc::Def *)def_ptr)->vars) { - auto it = sym2ds.find(SymbolIdx{usr1, Kind::Var}); - if (it != sym2ds.end() && it->second) - ds->children.push_back(std::move(it->second)); - } - for (auto &[def_ptrs, ds] : types) - for (const void *def_ptr : def_ptrs) { - auto *def = (const QueryType::Def *)def_ptr; - for (Usr usr1 : def->funcs) { - auto it = sym2ds.find(SymbolIdx{usr1, Kind::Func}); - if (it != sym2ds.end() && it->second) - ds->children.push_back(std::move(it->second)); - } - for (Usr usr1 : def->types) { - auto it = sym2ds.find(SymbolIdx{usr1, Kind::Type}); - if (it != sym2ds.end() && it->second) - ds->children.push_back(std::move(it->second)); + if (!ignore(def) && (ds->kind == SymbolKind::Namespace || allows(sym))) { + // Drop scopes which are before selectionRange.start. In + // `int i, j, k;`, the scope of i will be ended by j. + while (!scopes.empty() && + scopes.back()->range.end <= ds->selectionRange.start) + scopes.pop_back(); + auto *ds1 = ds.get(); + if (scopes.empty()) + res.push_back(std::move(ds)); + else + scopes.back()->children.push_back(std::move(ds)); + scopes.push_back(ds1); } - for (auto [usr1, _] : def->vars) { - auto it = sym2ds.find(SymbolIdx{usr1, Kind::Var}); - if (it != sym2ds.end() && it->second) - ds->children.push_back(std::move(it->second)); - } - } - std::vector<std::unique_ptr<DocumentSymbol>> result; - for (auto &[_, ds] : sym2ds) - if (ds) { - uniquify(ds->children); - result.push_back(std::move(ds)); - } - uniquify(result); - reply(result); + }); + } + reply(res); } else { std::vector<SymbolInformation> result; for (auto [sym, refcnt] : file->symbol2refcnt) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/messages/textDocument_signatureHelp.cc new/ccls-0.20220729/src/messages/textDocument_signatureHelp.cc --- old/ccls-0.20210330/src/messages/textDocument_signatureHelp.cc 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/messages/textDocument_signatureHelp.cc 2022-04-17 07:29:03.000000000 +0200 @@ -81,6 +81,10 @@ , SourceLocation openParLoc #endif +#if LLVM_VERSION_MAJOR >= 14 + , + bool braced +#endif ) override { ls_sighelp.activeParameter = (int)currentArg; for (unsigned i = 0; i < numCandidates; i++) { @@ -93,7 +97,11 @@ cand = OverloadCandidate(pattern); const auto *ccs = +#if LLVM_VERSION_MAJOR >= 14 + cand.CreateSignatureString(currentArg, s, *alloc, cCTUInfo, true, braced); +#else cand.CreateSignatureString(currentArg, s, *alloc, cCTUInfo, true); +#endif const char *ret_type = nullptr; SignatureInformation &ls_sig = ls_sighelp.signatures.emplace_back(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/pipeline.cc new/ccls-0.20220729/src/pipeline.cc --- old/ccls-0.20210330/src/pipeline.cc 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/pipeline.cc 2022-04-17 07:29:03.000000000 +0200 @@ -377,7 +377,7 @@ SmallString<256> msg; (Twine(deleted ? "delete " : "parse ") + path_to_index).toVector(msg); if (n_errs) - msg += (" error:" + Twine(n_errs) + " " + first_error).toStringRef(tmp); + msg += " error:" + std::to_string(n_errs) + ' ' + first_error; if (LOG_V_ENABLED(1)) { msg += "\n "; for (const char *arg : entry.args) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/platform_posix.cc new/ccls-0.20220729/src/platform_posix.cc --- old/ccls-0.20210330/src/platform_posix.cc 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/platform_posix.cc 2022-04-17 07:29:03.000000000 +0200 @@ -1,7 +1,7 @@ // Copyright 2017-2018 ccls Authors // SPDX-License-Identifier: Apache-2.0 -#if defined(__unix__) || defined(__APPLE__) +#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) #include "platform.hh" #include "utils.hh" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/query.cc new/ccls-0.20220729/src/query.cc --- old/ccls-0.20210330/src/query.cc 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/query.cc 2022-04-17 07:29:03.000000000 +0200 @@ -9,6 +9,8 @@ #include <rapidjson/document.h> +#include <llvm/ADT/STLExtras.h> + #include <assert.h> #include <functional> #include <limits.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/sema_manager.cc new/ccls-0.20220729/src/sema_manager.cc --- old/ccls-0.20210330/src/sema_manager.cc 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/sema_manager.cc 2022-04-17 07:29:03.000000000 +0200 @@ -178,11 +178,19 @@ : sm(sm), out(out) {} void InclusionDirective(SourceLocation hashLoc, const Token &includeTok, StringRef fileName, bool isAngled, - CharSourceRange filenameRange, const FileEntry *file, + CharSourceRange filenameRange, +#if LLVM_VERSION_MAJOR >= 15 // llvmorg-15-init-7692-gd79ad2f1dbc2 + llvm::Optional<FileEntryRef> fileRef, +#else + const FileEntry *file, +#endif StringRef searchPath, StringRef relativePath, const clang::Module *imported, SrcMgr::CharacteristicKind fileKind) override { (void)sm; +#if LLVM_VERSION_MAJOR >= 15 // llvmorg-15-init-7692-gd79ad2f1dbc2 + const FileEntry *file = fileRef ? &fileRef->getFileEntry() : nullptr; +#endif if (file && seen.insert(file).second) out.emplace_back(pathFromFileEntry(*file), file->getModificationTime()); } @@ -327,19 +335,26 @@ bool parse(CompilerInstance &clang) { SyntaxOnlyAction action; - if (!action.BeginSourceFile(clang, clang.getFrontendOpts().Inputs[0])) - return false; + llvm::CrashRecoveryContext crc; + bool ok = false; + auto run = [&]() { + if (!action.BeginSourceFile(clang, clang.getFrontendOpts().Inputs[0])) + return; #if LLVM_VERSION_MAJOR >= 9 // rL364464 - if (llvm::Error e = action.Execute()) { - llvm::consumeError(std::move(e)); - return false; - } + if (llvm::Error e = action.Execute()) { + llvm::consumeError(std::move(e)); + return; + } #else - if (!action.Execute()) - return false; + if (!action.Execute()) + return; #endif - action.EndSourceFile(); - return true; + action.EndSourceFile(); + ok = true; + }; + if (!crc.RunSafely(run)) + LOG_S(ERROR) << "clang crashed"; + return ok; } void buildPreamble(Session &session, CompilerInvocation &ci, @@ -414,7 +429,8 @@ auto *manager = static_cast<SemaManager *>(manager_); set_thread_name("preamble"); while (true) { - SemaManager::PreambleTask task = manager->preamble_tasks.dequeue(); + SemaManager::PreambleTask task = manager->preamble_tasks.dequeue( + g_config ? g_config->session.maxNum : 0); if (pipeline::g_quit.load(std::memory_order_relaxed)) break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/threaded_queue.hh new/ccls-0.20220729/src/threaded_queue.hh --- old/ccls-0.20210330/src/threaded_queue.hh 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/threaded_queue.hh 2022-04-17 07:29:03.000000000 +0200 @@ -126,12 +126,14 @@ bool isEmpty() { return total_count_ == 0; } // Get the first element from the queue. Blocks until one is available. - T dequeue() { + T dequeue(int keep_only_latest = 0) { std::unique_lock<std::mutex> lock(mutex_); waiter_->cv.wait(lock, [&]() { return !priority_.empty() || !queue_.empty(); }); auto execute = [&](std::deque<T> *q) { + if (keep_only_latest > 0 && q->size() > keep_only_latest) + q->erase(q->begin(), q->end() - keep_only_latest); auto val = std::move(q->front()); q->pop_front(); --total_count_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccls-0.20210330/src/working_files.cc new/ccls-0.20220729/src/working_files.cc --- old/ccls-0.20210330/src/working_files.cc 2021-03-31 08:33:43.000000000 +0200 +++ new/ccls-0.20220729/src/working_files.cc 2022-04-17 07:29:03.000000000 +0200 @@ -342,7 +342,10 @@ Position WorkingFile::getCompletionPosition(Position pos, std::string *filter) const { int start = getOffsetForPosition(pos, buffer_content); int i = start; - while (i > 0 && isIdentifierBody(buffer_content[i - 1])) +#if LLVM_VERSION_MAJOR < 14 // llvmorg-14-init-3863-g601102d282d5 +#define isAsciiIdentifierContinue isIdentifierBody +#endif + while (i > 0 && isAsciiIdentifierContinue(buffer_content[i - 1])) --i; *filter = buffer_content.substr(i, start - i); return getPositionForOffset(buffer_content, i); @@ -455,10 +458,10 @@ c = content[start - 1]; if (c == ':' && start > 1 && content[start - 2] == ':') start--; - else if (!isIdentifierBody(c)) + else if (!isAsciiIdentifierContinue(c)) break; } - for (; end < content.size() && isIdentifierBody(content[end]); end++) + for (; end < content.size() && isAsciiIdentifierContinue(content[end]); end++) ; return content.substr(start, end - start);
participants (1)
-
Source-Sync