mirror of
https://github.com/MaskRay/ccls.git
synced 2025-12-19 13:42:08 +00:00
Compare commits
4 Commits
ce6fab9d46
...
f359ea4377
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f359ea4377 | ||
|
|
d31cc9f076 | ||
|
|
5d401fc95d | ||
|
|
e55cc6865c |
@ -364,9 +364,11 @@ try_again:
|
|||||||
|
|
||||||
// FIXME: Template type parameters!
|
// FIXME: Template type parameters!
|
||||||
|
|
||||||
|
#if LLVM_VERSION_MAJOR < 22 // llvmorg-22-init-3166-g91cdd35008e9
|
||||||
case Type::Elaborated:
|
case Type::Elaborated:
|
||||||
tp = cast<ElaboratedType>(tp)->getNamedType().getTypePtrOrNull();
|
tp = cast<ElaboratedType>(tp)->getNamedType().getTypePtrOrNull();
|
||||||
goto try_again;
|
goto try_again;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1266,7 +1268,7 @@ IndexResult index(WorkingFiles *wfiles, VFS *vfs, const std::string &opt_wdir, c
|
|||||||
clang->setInvocation(std::move(ci));
|
clang->setInvocation(std::move(ci));
|
||||||
#endif
|
#endif
|
||||||
clang->createDiagnostics(
|
clang->createDiagnostics(
|
||||||
#if LLVM_VERSION_MAJOR >= 20
|
#if LLVM_VERSION_MAJOR >= 20 && LLVM_VERSION_MAJOR < 22
|
||||||
*fs,
|
*fs,
|
||||||
#endif
|
#endif
|
||||||
&dc, false);
|
&dc, false);
|
||||||
@ -1279,7 +1281,12 @@ IndexResult index(WorkingFiles *wfiles, VFS *vfs, const std::string &opt_wdir, c
|
|||||||
if (!clang->hasTarget())
|
if (!clang->hasTarget())
|
||||||
return {};
|
return {};
|
||||||
clang->getPreprocessorOpts().RetainRemappedFileBuffers = true;
|
clang->getPreprocessorOpts().RetainRemappedFileBuffers = true;
|
||||||
|
#if LLVM_VERSION_MAJOR >= 22
|
||||||
|
clang->setVirtualFileSystem(fs);
|
||||||
|
clang->createFileManager();
|
||||||
|
#else
|
||||||
clang->createFileManager(fs);
|
clang->createFileManager(fs);
|
||||||
|
#endif
|
||||||
clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true));
|
clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true));
|
||||||
|
|
||||||
IndexParam param(*vfs, no_linkage);
|
IndexParam param(*vfs, no_linkage);
|
||||||
|
|||||||
@ -296,7 +296,7 @@ private:
|
|||||||
void textDocument_signatureHelp(TextDocumentPositionParam &, ReplyOnce &);
|
void textDocument_signatureHelp(TextDocumentPositionParam &, ReplyOnce &);
|
||||||
void textDocument_switchSourceHeader(TextDocumentIdentifier &, ReplyOnce &);
|
void textDocument_switchSourceHeader(TextDocumentIdentifier &, ReplyOnce &);
|
||||||
void textDocument_typeDefinition(TextDocumentPositionParam &, ReplyOnce &);
|
void textDocument_typeDefinition(TextDocumentPositionParam &, ReplyOnce &);
|
||||||
void workspace_didChangeConfiguration(EmptyParam &);
|
void workspace_didChangeConfiguration(JsonReader &);
|
||||||
void workspace_didChangeWatchedFiles(DidChangeWatchedFilesParam &);
|
void workspace_didChangeWatchedFiles(DidChangeWatchedFilesParam &);
|
||||||
void workspace_didChangeWorkspaceFolders(DidChangeWorkspaceFoldersParam &);
|
void workspace_didChangeWorkspaceFolders(DidChangeWorkspaceFoldersParam &);
|
||||||
void workspace_executeCommand(JsonReader &, ReplyOnce &);
|
void workspace_executeCommand(JsonReader &, ReplyOnce &);
|
||||||
|
|||||||
@ -345,7 +345,11 @@ void do_initialize(MessageHandler *m, InitializeParam ¶m, ReplyOnce &reply)
|
|||||||
|
|
||||||
if (g_config->cache.directory.size()) {
|
if (g_config->cache.directory.size()) {
|
||||||
SmallString<256> path(g_config->cache.directory);
|
SmallString<256> path(g_config->cache.directory);
|
||||||
|
#if LLVM_VERSION_MAJOR >= 22
|
||||||
|
sys::path::make_absolute(project_path, path);
|
||||||
|
#else
|
||||||
sys::fs::make_absolute(project_path, path);
|
sys::fs::make_absolute(project_path, path);
|
||||||
|
#endif
|
||||||
// Use upper case for the Driver letter on Windows.
|
// Use upper case for the Driver letter on Windows.
|
||||||
g_config->cache.directory = normalizePath(path.str());
|
g_config->cache.directory = normalizePath(path.str());
|
||||||
ensureEndsInSlash(g_config->cache.directory);
|
ensureEndsInSlash(g_config->cache.directory);
|
||||||
|
|||||||
@ -13,6 +13,9 @@
|
|||||||
#include <llvm/ADT/StringRef.h>
|
#include <llvm/ADT/StringRef.h>
|
||||||
#include <llvm/Support/Path.h>
|
#include <llvm/Support/Path.h>
|
||||||
|
|
||||||
|
#include <rapidjson/document.h>
|
||||||
|
#include <rapidjson/writer.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -22,13 +25,31 @@ using namespace llvm;
|
|||||||
namespace ccls {
|
namespace ccls {
|
||||||
REFLECT_STRUCT(SymbolInformation, name, kind, location, containerName);
|
REFLECT_STRUCT(SymbolInformation, name, kind, location, containerName);
|
||||||
|
|
||||||
void MessageHandler::workspace_didChangeConfiguration(EmptyParam &) {
|
void MessageHandler::workspace_didChangeConfiguration(JsonReader &reader) {
|
||||||
|
auto it = reader.m->FindMember("settings");
|
||||||
|
if (!(it != reader.m->MemberEnd() && it->value.IsObject()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Similar to MessageHandler::initialize.
|
||||||
|
rapidjson::StringBuffer output;
|
||||||
|
rapidjson::Writer<rapidjson::StringBuffer> writer(output);
|
||||||
|
JsonReader m1(&it->value);
|
||||||
|
it->value.Accept(writer);
|
||||||
|
LOG_S(INFO) << "didChangeConfiguration: " << output.GetString();
|
||||||
|
try {
|
||||||
|
reflect(m1, *g_config);
|
||||||
|
} catch (std::invalid_argument &) {
|
||||||
|
reader.path_.push_back("settings");
|
||||||
|
reader.path_.insert(reader.path_.end(), m1.path_.begin(), m1.path_.end());
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto &[folder, _] : g_config->workspaceFolders)
|
for (auto &[folder, _] : g_config->workspaceFolders)
|
||||||
project->load(folder);
|
project->load(folder);
|
||||||
project->index(wfiles, RequestId());
|
project->index(wfiles, RequestId());
|
||||||
|
|
||||||
manager->clear();
|
manager->clear();
|
||||||
};
|
}
|
||||||
|
|
||||||
void MessageHandler::workspace_didChangeWatchedFiles(DidChangeWatchedFilesParam ¶m) {
|
void MessageHandler::workspace_didChangeWatchedFiles(DidChangeWatchedFilesParam ¶m) {
|
||||||
for (auto &event : param.changes) {
|
for (auto &event : param.changes) {
|
||||||
|
|||||||
@ -268,7 +268,7 @@ std::unique_ptr<CompilerInstance> buildCompilerInstance(Session &session, std::u
|
|||||||
clang->setInvocation(std::move(ci));
|
clang->setInvocation(std::move(ci));
|
||||||
#endif
|
#endif
|
||||||
clang->createDiagnostics(
|
clang->createDiagnostics(
|
||||||
#if LLVM_VERSION_MAJOR >= 20
|
#if LLVM_VERSION_MAJOR >= 20 && LLVM_VERSION_MAJOR < 22
|
||||||
*fs,
|
*fs,
|
||||||
#endif
|
#endif
|
||||||
&dc, false);
|
&dc, false);
|
||||||
@ -283,7 +283,12 @@ std::unique_ptr<CompilerInstance> buildCompilerInstance(Session &session, std::u
|
|||||||
// Construct SourceManager with UserFilesAreVolatile: true because otherwise
|
// Construct SourceManager with UserFilesAreVolatile: true because otherwise
|
||||||
// RequiresNullTerminator: true may cause out-of-bounds read when a file is
|
// RequiresNullTerminator: true may cause out-of-bounds read when a file is
|
||||||
// mmap'ed but is saved concurrently.
|
// mmap'ed but is saved concurrently.
|
||||||
|
#if LLVM_VERSION_MAJOR >= 22
|
||||||
|
clang->setVirtualFileSystem(fs);
|
||||||
|
clang->createFileManager();
|
||||||
|
#else
|
||||||
clang->createFileManager(fs);
|
clang->createFileManager(fs);
|
||||||
|
#endif
|
||||||
clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true));
|
clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true));
|
||||||
auto &isec = clang->getFrontendOpts().Inputs;
|
auto &isec = clang->getFrontendOpts().Inputs;
|
||||||
if (isec.size()) {
|
if (isec.size()) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user