mirror of
https://github.com/MaskRay/ccls.git
synced 2025-06-19 06:27:42 +00:00
Compare commits
1 Commits
3799e38920
...
d78587c18d
Author | SHA1 | Date | |
---|---|---|---|
|
d78587c18d |
@ -377,17 +377,10 @@ const Decl *getAdjustedDecl(const Decl *d) {
|
|||||||
if (!s->isExplicitSpecialization()) {
|
if (!s->isExplicitSpecialization()) {
|
||||||
llvm::PointerUnion<ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl *> result =
|
llvm::PointerUnion<ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl *> result =
|
||||||
s->getSpecializedTemplateOrPartial();
|
s->getSpecializedTemplateOrPartial();
|
||||||
#if LLVM_VERSION_MAJOR >= 21
|
if (result.is<ClassTemplateDecl *>())
|
||||||
if (auto *ctd = dyn_cast<ClassTemplateDecl *>(result))
|
|
||||||
d = ctd;
|
|
||||||
else
|
|
||||||
d = cast<ClassTemplatePartialSpecializationDecl *>(result);
|
|
||||||
#else
|
|
||||||
if (isa<ClassTemplateDecl *>(result))
|
|
||||||
d = result.get<ClassTemplateDecl *>();
|
d = result.get<ClassTemplateDecl *>();
|
||||||
else
|
else
|
||||||
d = result.get<ClassTemplatePartialSpecializationDecl *>();
|
d = result.get<ClassTemplatePartialSpecializationDecl *>();
|
||||||
#endif
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (auto *d1 = r->getInstantiatedFromMemberClass()) {
|
} else if (auto *d1 = r->getInstantiatedFromMemberClass()) {
|
||||||
@ -971,17 +964,10 @@ public:
|
|||||||
else if (auto *sd = dyn_cast<ClassTemplateSpecializationDecl>(rd)) {
|
else if (auto *sd = dyn_cast<ClassTemplateSpecializationDecl>(rd)) {
|
||||||
llvm::PointerUnion<ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl *> result =
|
llvm::PointerUnion<ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl *> result =
|
||||||
sd->getSpecializedTemplateOrPartial();
|
sd->getSpecializedTemplateOrPartial();
|
||||||
#if LLVM_VERSION_MAJOR >= 21
|
|
||||||
if (auto *ctd = dyn_cast<ClassTemplateDecl *>(result))
|
|
||||||
d1 = ctd;
|
|
||||||
else
|
|
||||||
d1 = cast<ClassTemplatePartialSpecializationDecl *>(result);
|
|
||||||
#else
|
|
||||||
if (result.is<ClassTemplateDecl *>())
|
if (result.is<ClassTemplateDecl *>())
|
||||||
d1 = result.get<ClassTemplateDecl *>();
|
d1 = result.get<ClassTemplateDecl *>();
|
||||||
else
|
else
|
||||||
d1 = result.get<ClassTemplatePartialSpecializationDecl *>();
|
d1 = result.get<ClassTemplatePartialSpecializationDecl *>();
|
||||||
#endif
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
d1 = rd->getInstantiatedFromMemberClass();
|
d1 = rd->getInstantiatedFromMemberClass();
|
||||||
@ -1255,23 +1241,15 @@ IndexResult index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, const st
|
|||||||
}
|
}
|
||||||
|
|
||||||
IndexDiags dc;
|
IndexDiags dc;
|
||||||
#if LLVM_VERSION_MAJOR >= 21
|
|
||||||
auto clang = std::make_unique<CompilerInstance>(std::move(ci), pch);
|
|
||||||
#else
|
|
||||||
auto clang = std::make_unique<CompilerInstance>(pch);
|
auto clang = std::make_unique<CompilerInstance>(pch);
|
||||||
clang->setInvocation(std::move(ci));
|
clang->setInvocation(std::move(ci));
|
||||||
#endif
|
|
||||||
clang->createDiagnostics(
|
clang->createDiagnostics(
|
||||||
#if LLVM_VERSION_MAJOR >= 20
|
#if LLVM_VERSION_MAJOR >= 20
|
||||||
*fs,
|
*fs,
|
||||||
#endif
|
#endif
|
||||||
&dc, false);
|
&dc, false);
|
||||||
clang->getDiagnostics().setIgnoreAllWarnings(true);
|
clang->getDiagnostics().setIgnoreAllWarnings(true);
|
||||||
#if LLVM_VERSION_MAJOR >= 21
|
|
||||||
clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getTargetOpts()));
|
|
||||||
#else
|
|
||||||
clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getInvocation().TargetOpts));
|
clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getInvocation().TargetOpts));
|
||||||
#endif
|
|
||||||
if (!clang->hasTarget())
|
if (!clang->hasTarget())
|
||||||
return {};
|
return {};
|
||||||
clang->getPreprocessorOpts().RetainRemappedFileBuffers = true;
|
clang->getPreprocessorOpts().RetainRemappedFileBuffers = true;
|
||||||
|
@ -364,8 +364,14 @@ bool indexer_Parse(SemaManager *completion, WorkingFiles *wfiles, Project *proje
|
|||||||
msg += " error:" + std::to_string(n_errs) + ' ' + first_error;
|
msg += " error:" + std::to_string(n_errs) + ' ' + first_error;
|
||||||
if (LOG_V_ENABLED(1)) {
|
if (LOG_V_ENABLED(1)) {
|
||||||
msg += "\n ";
|
msg += "\n ";
|
||||||
for (const char *arg : entry.args)
|
for (const char *arg_c : entry.args) {
|
||||||
(msg += ' ') += arg;
|
msg += ' ';
|
||||||
|
std::string_view arg(arg_c);
|
||||||
|
if (arg.find_first_of("\"()<>") != std::string::npos)
|
||||||
|
((msg += "'") += arg) += "'";
|
||||||
|
else
|
||||||
|
msg += arg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LOG_S(INFO) << std::string_view(msg.data(), msg.size());
|
LOG_S(INFO) << std::string_view(msg.data(), msg.size());
|
||||||
}
|
}
|
||||||
@ -684,14 +690,6 @@ void mainLoop() {
|
|||||||
path2backlog[ex.path].push_back(&backlog.back());
|
path2backlog[ex.path].push_back(&backlog.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the "exit" notification has been received, clear all index requests
|
|
||||||
// to make indexers stop in time.
|
|
||||||
if (g_quit.load(std::memory_order_relaxed)) {
|
|
||||||
index_request->apply([&](std::deque<IndexRequest> &q) {
|
|
||||||
q.clear();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
bool indexed = false;
|
bool indexed = false;
|
||||||
for (int i = 20; i--;) {
|
for (int i = 20; i--;) {
|
||||||
std::optional<IndexUpdate> update = on_indexed->tryPopFront();
|
std::optional<IndexUpdate> update = on_indexed->tryPopFront();
|
||||||
|
@ -261,22 +261,14 @@ std::unique_ptr<CompilerInstance> buildCompilerInstance(Session &session, std::u
|
|||||||
else
|
else
|
||||||
ci->getPreprocessorOpts().addRemappedFile(main, buf.get());
|
ci->getPreprocessorOpts().addRemappedFile(main, buf.get());
|
||||||
|
|
||||||
#if LLVM_VERSION_MAJOR >= 21
|
|
||||||
auto clang = std::make_unique<CompilerInstance>(std::move(ci), session.pch);
|
|
||||||
#else
|
|
||||||
auto clang = std::make_unique<CompilerInstance>(session.pch);
|
auto clang = std::make_unique<CompilerInstance>(session.pch);
|
||||||
clang->setInvocation(std::move(ci));
|
clang->setInvocation(std::move(ci));
|
||||||
#endif
|
|
||||||
clang->createDiagnostics(
|
clang->createDiagnostics(
|
||||||
#if LLVM_VERSION_MAJOR >= 20
|
#if LLVM_VERSION_MAJOR >= 20
|
||||||
*fs,
|
*fs,
|
||||||
#endif
|
#endif
|
||||||
&dc, false);
|
&dc, false);
|
||||||
#if LLVM_VERSION_MAJOR >= 21
|
|
||||||
clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getTargetOpts()));
|
|
||||||
#else
|
|
||||||
clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getInvocation().TargetOpts));
|
clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getInvocation().TargetOpts));
|
||||||
#endif
|
|
||||||
if (!clang->hasTarget())
|
if (!clang->hasTarget())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
clang->getPreprocessorOpts().RetainRemappedFileBuffers = true;
|
clang->getPreprocessorOpts().RetainRemappedFileBuffers = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user