summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--clang-tools-extra/clangd/index/Background.h6
-rw-r--r--clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp6
-rw-r--r--clang-tools-extra/clangd/test/background-index.test4
-rw-r--r--llvm/.gitignore2
5 files changed, 12 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 43ff4794b019..1c8d4b15925d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,10 +53,11 @@ autoconf/autom4te.cache
# VS2017 and VSCode config files.
.vscode
.vs
-# clangd index
-.clangd
+# clangd index. (".clangd" is a config file now, thus trailing slash)
+.clangd/
+.cache
# static analyzer regression testing project files
/clang/utils/analyzer/projects/*/CachedSource
/clang/utils/analyzer/projects/*/PatchedSource
/clang/utils/analyzer/projects/*/ScanBuildResults
-/clang/utils/analyzer/projects/*/RefScanBuildResults \ No newline at end of file
+/clang/utils/analyzer/projects/*/RefScanBuildResults
diff --git a/clang-tools-extra/clangd/index/Background.h b/clang-tools-extra/clangd/index/Background.h
index 9f9b1b712659..9adad1737686 100644
--- a/clang-tools-extra/clangd/index/Background.h
+++ b/clang-tools-extra/clangd/index/Background.h
@@ -56,9 +56,9 @@ public:
using Factory = llvm::unique_function<BackgroundIndexStorage *(PathRef)>;
// Creates an Index Storage that saves shards into disk. Index storage uses
- // CDBDirectory + ".clangd/index/" as the folder to save shards. CDBDirectory
- // is the first directory containing a CDB in parent directories of a file, or
- // user's home directory if none was found, e.g. standard library headers.
+ // CDBDirectory + ".cache/clangd/index/" as the folder to save shards.
+ // CDBDirectory is the first directory containing a CDB in parent directories
+ // of a file, or user cache directory if none was found, e.g. stdlib headers.
static Factory createDiskBackedStorageFactory(
std::function<llvm::Optional<ProjectInfo>(PathRef)> GetProjectInfo);
};
diff --git a/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp b/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
index eee050b0db9a..ed1662ff5988 100644
--- a/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
+++ b/clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
@@ -95,8 +95,8 @@ public:
};
// Creates and owns IndexStorages for multiple CDBs.
-// When a CDB root is found, shards are stored in $ROOT/.clangd/index.
-// When no root is found, the fallback path is ~/.cache/clangd/index.
+// When a CDB root is found, shards are stored in $ROOT/.cache/clangd/index/.
+// When no root is found, the fallback path is ~/.cache/clangd/index/.
class DiskBackedIndexStorageManager {
public:
DiskBackedIndexStorageManager(
@@ -115,7 +115,7 @@ public:
llvm::SmallString<128> StorageDir(FallbackDir);
if (auto PI = GetProjectInfo(File)) {
StorageDir = PI->SourceRoot;
- llvm::sys::path::append(StorageDir, ".clangd", "index");
+ llvm::sys::path::append(StorageDir, ".cache", "clangd", "index");
}
auto &IndexStorage = IndexStorageMap[StorageDir];
if (!IndexStorage)
diff --git a/clang-tools-extra/clangd/test/background-index.test b/clang-tools-extra/clangd/test/background-index.test
index 821ac7174f59..41184443e947 100644
--- a/clang-tools-extra/clangd/test/background-index.test
+++ b/clang-tools-extra/clangd/test/background-index.test
@@ -15,8 +15,8 @@
# RUN: clangd -background-index -lit-test < %t/definition.jsonrpc | FileCheck %t/definition.jsonrpc --check-prefixes=CHECK,BUILD
# Test that the index is writing files in the expected location.
-# RUN: ls %t/.clangd/index/foo.cpp.*.idx
-# RUN: ls %t/sub_dir/.clangd/index/foo.h.*.idx
+# RUN: ls %t/.cache/clangd/index/foo.cpp.*.idx
+# RUN: ls %t/sub_dir/.cache/clangd/index/foo.h.*.idx
# Test the index is read from disk: delete code and restart clangd.
# RUN: rm %t/foo.cpp
diff --git a/llvm/.gitignore b/llvm/.gitignore
index f2b343ade4f3..d6021ff18e1f 100644
--- a/llvm/.gitignore
+++ b/llvm/.gitignore
@@ -59,8 +59,6 @@ docs/_build
# VS2017 and VSCode config files.
.vscode
.vs
-# clangd index
-.clangd
#==============================================================================#
# Files created in tree by the Go bindings.