10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERS_H 11 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERS_H 16 #include "clang/Format/Format.h" 17 #include "clang/Lex/HeaderSearch.h" 18 #include "clang/Lex/PPCallbacks.h" 19 #include "clang/Tooling/Inclusions/HeaderIncludes.h" 20 #include "llvm/ADT/StringRef.h" 21 #include "llvm/ADT/StringSet.h" 22 #include "llvm/Support/Error.h" 23 #include "llvm/Support/VirtualFileSystem.h" 46 unsigned HashOffset = 0;
47 SrcMgr::CharacteristicKind FileKind = SrcMgr::C_User;
85 llvm::StringMap<unsigned> includeDepth(llvm::StringRef Root)
const;
88 void recordInclude(llvm::StringRef IncludingName,
89 llvm::StringRef IncludedName,
90 llvm::StringRef IncludedRealName);
98 std::vector<std::string> RealPathNames;
99 unsigned fileIndex(llvm::StringRef
Name);
100 llvm::StringMap<unsigned> NameToIndex;
102 llvm::DenseMap<unsigned, SmallVector<unsigned, 8>> IncludeChildren;
106 std::unique_ptr<PPCallbacks>
114 HeaderSearch &HeaderSearchInfo)
115 : FileName(FileName), Code(Code), BuildDir(BuildDir),
116 HeaderSearchInfo(HeaderSearchInfo),
117 Inserter(FileName, Code, Style.IncludeStyle) {}
131 bool shouldInsertInclude(
const HeaderFile &DeclaringHeader,
144 std::string calculateIncludePath(
const HeaderFile &DeclaringHeader,
149 llvm::Optional<TextEdit> insert(llvm::StringRef VerbatimHeader)
const;
155 HeaderSearch &HeaderSearchInfo;
156 llvm::StringSet<> IncludedHeaders;
157 tooling::HeaderIncludes Inserter;
163 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERS_H
IncludeInserter(StringRef FileName, StringRef Code, const format::FormatStyle &Style, StringRef BuildDir, HeaderSearch &HeaderSearchInfo)
decltype(llvm::SHA1::hash({})) FileDigest
std::vector< llvm::StringRef > DirectIncludes
llvm::StringMap< IncludeGraphNode > IncludeGraph
std::string Path
A typedef to represent a file path.
static constexpr llvm::StringLiteral Name
std::vector< Inclusion > MainFileIncludes
std::unique_ptr< PPCallbacks > collectIncludeStructureCallback(const SourceManager &SM, IncludeStructure *Out)
Returns a PPCallback that visits all inclusions in the main file.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
bool isLiteralInclude(llvm::StringRef Include)
Returns true if Include is literal include like "path" or <path>.
static cl::opt< std::string > FormatStyle("format-style", cl::desc(R"(
Style for formatting code around applied fixes:
- 'none' (default) turns off formatting
- 'file' (literally 'file', not a placeholder)
uses .clang-format file in the closest parent
directory
- '{ <json> }' specifies options inline, e.g.
-format-style='{BasedOnStyle: llvm, IndentWidth: 8}'
- 'llvm', 'google', 'webkit', 'mozilla'
See clang-format documentation for the up-to-date
information about formatting styles and options.
This option overrides the 'FormatStyle` option in
.clang-tidy file, if any.
)"), cl::init("none"), cl::cat(ClangTidyCategory))