14 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SOURCECODE_H 15 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SOURCECODE_H 17 #include "clang/Basic/Diagnostic.h" 18 #include "clang/Basic/SourceLocation.h" 19 #include "clang/Basic/SourceManager.h" 20 #include "clang/Tooling/Core/Replacement.h" 21 #include "llvm/Support/SHA1.h" 33 Optional<FileDigest>
digestFile(
const SourceManager &SM, FileID FID);
46 llvm::Expected<size_t>
48 bool AllowColumnsBeyondLineLength =
true);
70 std::pair<llvm::StringRef, llvm::StringRef>
76 const tooling::Replacements &Repls);
79 const LangOptions &L);
92 const SourceManager &SourceMgr);
SourceLocation Loc
'#' location in the include directive
size_t lspLength(llvm::StringRef Code)
decltype(llvm::SHA1::hash({})) FileDigest
bool IsRangeConsecutive(const Range &Left, const Range &Right)
std::pair< size_t, size_t > offsetToClangLineColumn(llvm::StringRef Code, size_t Offset)
TextEdit toTextEdit(const FixItHint &FixIt, const SourceManager &M, const LangOptions &L)
Position offsetToPosition(llvm::StringRef Code, size_t Offset)
Turn an offset in Code into a [line, column] pair.
llvm::Expected< size_t > positionToOffset(llvm::StringRef Code, Position P, bool AllowColumnsBeyondLineLength)
Turn a [line, column] pair into an offset in Code.
llvm::Optional< FileDigest > digestFile(const SourceManager &SM, FileID FID)
Position sourceLocToPosition(const SourceManager &SM, SourceLocation Loc)
Turn a SourceLocation into a [line, column] pair.
FileDigest digest(llvm::StringRef Content)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
TextEdit replacementToEdit(llvm::StringRef Code, const tooling::Replacement &R)
std::pair< llvm::StringRef, llvm::StringRef > splitQualifiedName(llvm::StringRef QName)
From "a::b::c", return {"a::b::", "c"}.
llvm::Optional< std::string > getCanonicalPath(const FileEntry *F, const SourceManager &SourceMgr)
Get the canonical path of F.
std::vector< TextEdit > replacementsToEdits(llvm::StringRef Code, const tooling::Replacements &Repls)
llvm::Optional< FixItHint > FixIt
Range halfOpenToRange(const SourceManager &SM, CharSourceRange R)