diff options
author | Kadir Cetinkaya <kadircet@google.com> | 2018-11-27 16:08:53 +0000 |
---|---|---|
committer | Kadir Cetinkaya <kadircet@google.com> | 2018-11-27 16:08:53 +0000 |
commit | d08eab42811f8146527d061be456cd1d80867f09 (patch) | |
tree | 0193cc0f8ddd2745a66ece039f029fc378fa16e6 /clang-tools-extra/clangd/SourceCode.h | |
parent | 5f4feea9106f6338e34e91afae6a6cb1abd49339 (diff) | |
download | bcm5719-llvm-d08eab42811f8146527d061be456cd1d80867f09.tar.gz bcm5719-llvm-d08eab42811f8146527d061be456cd1d80867f09.zip |
[clangd] Put direct headers into srcs section.
Summary:
Currently, there's no way of knowing about header files
using compilation database, since it doesn't contain header files as entries.
Using this information, restoring from cache using compile commands becomes
possible instead of doing directory traversal. Also, we can issue indexing
actions for out-of-date headers even if source files depending on them haven't
changed.
Reviewers: sammccall
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D54817
llvm-svn: 347669
Diffstat (limited to 'clang-tools-extra/clangd/SourceCode.h')
-rw-r--r-- | clang-tools-extra/clangd/SourceCode.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/SourceCode.h b/clang-tools-extra/clangd/SourceCode.h index fd5d53b418d..769d0afc721 100644 --- a/clang-tools-extra/clangd/SourceCode.h +++ b/clang-tools-extra/clangd/SourceCode.h @@ -16,13 +16,22 @@ #include "Protocol.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceLocation.h" +#include "clang/Basic/SourceManager.h" #include "clang/Tooling/Core/Replacement.h" +#include "llvm/Support/SHA1.h" namespace clang { class SourceManager; namespace clangd { +// We tend to generate digests for source codes in a lot of different places. +// This represents the type for those digests to prevent us hard coding details +// of hashing function at every place that needs to store this information. +using FileDigest = decltype(llvm::SHA1::hash({})); +FileDigest digest(StringRef Content); +Optional<FileDigest> digestFile(const SourceManager &SM, FileID FID); + // Counts the number of UTF-16 code units needed to represent a string (LSP // specifies string lengths in UTF-16 code units). size_t lspLength(StringRef Code); |