diff options
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); |