Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/scan_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "support/path_pool.h"
#include "syntax/dependency_graph.h"

#include "kota/codec/json/serializer.h"
#include "kota/codec/json/json.h"
#include "kota/deco/deco.h"
#include "llvm/Support/FileSystem.h"

Expand Down
7 changes: 4 additions & 3 deletions src/compile/compilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@ class ProxyAction final : public clang::WrapperFrontendAction {

auto CreateASTConsumer(clang::CompilerInstance& instance, llvm::StringRef file)
-> std::unique_ptr<clang::ASTConsumer> final {
return std::make_unique<ProxyASTConsumer>(
WrapperFrontendAction::CreateASTConsumer(instance, file),
unit);
auto consumer = WrapperFrontendAction::CreateASTConsumer(instance, file);
if(!consumer)
return nullptr;
return std::make_unique<ProxyASTConsumer>(std::move(consumer), unit);
}

/// Make this public.
Expand Down
3 changes: 2 additions & 1 deletion src/compile/compilation_unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ auto CompilationUnitRef::file_offset(clang::SourceLocation location) -> std::uin
}

auto CompilationUnitRef::file_path(clang::FileID fid) -> llvm::StringRef {
assert(fid.isValid() && "Invalid fid");
if(!fid.isValid())
return {};
if(auto it = self->path_cache.find(fid); it != self->path_cache.end()) {
return it->second;
}
Expand Down
16 changes: 16 additions & 0 deletions src/server/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,22 @@ kota::task<bool> Compiler::ensure_pch(Session& session,
auto completion = std::make_shared<kota::event>();
workspace.pch_cache[path_id].building = completion;

if(workspace.config.project.cache_dir.empty()) {
LOG_WARN("PCH build skipped: cache_dir is not configured");
workspace.pch_cache[path_id].building.reset();
completion->set();
co_return false;
}

// Ensure the PCH cache directory exists.
auto pch_dir = path::join(workspace.config.project.cache_dir, "cache", "pch");
if(auto ec = llvm::sys::fs::create_directories(pch_dir)) {
LOG_WARN("Cannot create PCH cache dir {}: {}", pch_dir, ec.message());
workspace.pch_cache[path_id].building.reset();
completion->set();
co_return false;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

// Build a new PCH via stateless worker.
worker::BuildParams bp;
bp.kind = worker::BuildKind::BuildPCH;
Expand Down
2 changes: 1 addition & 1 deletion src/server/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "syntax/completion.h"

#include "kota/async/async.h"
#include "kota/codec/raw_value.h"
#include "kota/codec/json/json.h"
#include "kota/ipc/codec/json.h"
#include "kota/ipc/lsp/protocol.h"
#include "kota/ipc/peer.h"
Expand Down
2 changes: 1 addition & 1 deletion src/server/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "support/logging.h"

#include "kota/codec/json/json.h"
#include "kota/codec/toml.h"
#include "kota/codec/toml/toml.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
Expand Down
8 changes: 4 additions & 4 deletions src/server/master_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ MasterServer::MasterServer(kota::event_loop& loop,

MasterServer::~MasterServer() = default;

kota::task<> MasterServer::load_workspace() {
void MasterServer::load_workspace() {
if(workspace_root.empty())
co_return;
return;

auto& cfg = workspace.config.project;

Expand Down Expand Up @@ -125,7 +125,7 @@ kota::task<> MasterServer::load_workspace() {

if(cdb_path.empty()) {
LOG_WARN("No compile_commands.json found in workspace {}", workspace_root);
co_return;
return;
}

auto count = workspace.cdb.load(cdb_path);
Expand Down Expand Up @@ -331,7 +331,7 @@ void MasterServer::register_handlers() {
indexer.schedule();
};

loop.schedule(load_workspace());
load_workspace();
});

peer.on_request(
Expand Down
4 changes: 2 additions & 2 deletions src/server/master_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "server/workspace.h"

#include "kota/async/async.h"
#include "kota/codec/raw_value.h"
#include "kota/codec/json/json.h"
#include "kota/ipc/peer.h"
#include "llvm/ADT/DenseMap.h"

Expand Down Expand Up @@ -73,7 +73,7 @@ class MasterServer {
std::string session_log_dir;
std::string init_options_json; ///< Raw JSON from initializationOptions, consumed once.

kota::task<> load_workspace();
void load_workspace();

using RawResult = kota::task<kota::codec::RawValue, kota::ipc::Error>;
};
Expand Down
2 changes: 1 addition & 1 deletion src/server/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "syntax/token.h"

#include "kota/codec/raw_value.h"
#include "kota/codec/json/json.h"
#include "kota/ipc/lsp/protocol.h"
#include "kota/ipc/protocol.h"

Expand Down
3 changes: 1 addition & 2 deletions src/server/worker_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

#include "compile/compilation.h"

#include "kota/codec/json/serializer.h"
#include "kota/codec/raw_value.h"
#include "kota/codec/json/json.h"
#include "kota/ipc/codec/json.h"

namespace clice {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/server/config_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "support/filesystem.h"

#include "kota/codec/json/json.h"
#include "kota/codec/toml.h"
#include "kota/codec/toml/toml.h"

namespace clice::testing {

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/server/stateful_worker_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "server/protocol.h"
#include "server/worker_test_helpers.h"

#include "kota/codec/raw_value.h"
#include "kota/codec/json/json.h"

namespace clice::testing {

Expand Down
1 change: 0 additions & 1 deletion tests/unit/server/stateless_worker_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "server/worker_test_helpers.h"

#include "kota/codec/bincode/bincode.h"
#include "kota/codec/raw_value.h"

namespace clice::testing {

Expand Down
Loading