Skip to content

Commit

Permalink
[clangd] Store index in '.clangd/index' instead of '.clangd-index'
Browse files Browse the repository at this point in the history
Summary: To take up the .clangd folder for other potential uses in the future.

Reviewers: kadircet, sammccall

Reviewed By: kadircet

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D58440

llvm-svn: 354505
  • Loading branch information
ilya-biryukov committed Feb 20, 2019
1 parent 1ce977f commit 2754942
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/index/Background.h
Expand Up @@ -54,7 +54,7 @@ class BackgroundIndexStorage {
llvm::unique_function<BackgroundIndexStorage *(llvm::StringRef)>;

// Creates an Index Storage that saves shards into disk. Index storage uses
// CDBDirectory + ".clangd-index/" as the folder to save shards.
// CDBDirectory + ".clangd/index/" as the folder to save shards.
static Factory createDiskBackedStorageFactory();
};

Expand Down
8 changes: 4 additions & 4 deletions clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
Expand Up @@ -63,19 +63,19 @@ writeAtomically(llvm::StringRef OutPath,
}

// Uses disk as a storage for index shards. Creates a directory called
// ".clangd-index/" under the path provided during construction.
// ".clangd/index/" under the path provided during construction.
class DiskBackedIndexStorage : public BackgroundIndexStorage {
std::string DiskShardRoot;

public:
// Sets DiskShardRoot to (Directory + ".clangd-index/") which is the base
// Sets DiskShardRoot to (Directory + ".clangd/index/") which is the base
// directory for all shard files.
DiskBackedIndexStorage(llvm::StringRef Directory) {
llvm::SmallString<128> CDBDirectory(Directory);
llvm::sys::path::append(CDBDirectory, ".clangd-index/");
llvm::sys::path::append(CDBDirectory, ".clangd", "index");
DiskShardRoot = CDBDirectory.str();
std::error_code OK;
std::error_code EC = llvm::sys::fs::create_directory(DiskShardRoot);
std::error_code EC = llvm::sys::fs::create_directories(DiskShardRoot);
if (EC != OK) {
elog("Failed to create directory {0} for index storage: {1}",
DiskShardRoot, EC.message());
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/test/clangd/background-index.test
Expand Up @@ -13,7 +13,7 @@
# RUN: clangd -background-index -background-index-rebuild-period=0 -lit-test < %t/definition.jsonrpc | FileCheck %t/definition.jsonrpc

# Test that the index is writing files in the expected location.
# RUN: ls %t/.clangd-index/foo.cpp.*.idx
# RUN: ls %t/.clangd/index/foo.cpp.*.idx

# Test the index is read from disk: delete code and restart clangd.
# RUN: rm %t/foo.cpp
Expand Down
4 changes: 2 additions & 2 deletions llvm/.gitignore
Expand Up @@ -72,8 +72,8 @@ docs/_build
# VS2017 and VSCode config files.
.vscode
.vs
# clangd background index
.clangd-index
# clangd index
.clangd

#==============================================================================#
# Files created in tree by the Go bindings.
Expand Down

0 comments on commit 2754942

Please sign in to comment.