10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERS_H 11 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERS_H 16 #include "clang/Basic/VirtualFileSystem.h" 17 #include "clang/Format/Format.h" 18 #include "clang/Lex/HeaderSearch.h" 19 #include "clang/Lex/PPCallbacks.h" 20 #include "clang/Tooling/Inclusions/HeaderIncludes.h" 21 #include "llvm/ADT/StringRef.h" 22 #include "llvm/ADT/StringSet.h" 23 #include "llvm/Support/Error.h" 66 llvm::StringMap<unsigned> includeDepth(llvm::StringRef Root)
const;
69 void recordInclude(llvm::StringRef IncludingName,
70 llvm::StringRef IncludedName,
71 llvm::StringRef IncludedRealName);
79 std::vector<std::string> RealPathNames;
80 unsigned fileIndex(llvm::StringRef
Name);
81 llvm::StringMap<unsigned> NameToIndex;
83 llvm::DenseMap<unsigned, SmallVector<unsigned, 8>> IncludeChildren;
87 std::unique_ptr<PPCallbacks>
95 HeaderSearch &HeaderSearchInfo)
96 : FileName(FileName), Code(Code), BuildDir(BuildDir),
97 HeaderSearchInfo(HeaderSearchInfo),
98 Inserter(FileName, Code, Style.IncludeStyle) {}
112 bool shouldInsertInclude(
const HeaderFile &DeclaringHeader,
125 std::string calculateIncludePath(
const HeaderFile &DeclaringHeader,
130 llvm::Optional<TextEdit> insert(llvm::StringRef VerbatimHeader)
const;
136 HeaderSearch &HeaderSearchInfo;
137 std::vector<Inclusion> Inclusions;
138 tooling::HeaderIncludes Inserter;
144 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERS_H
IncludeInserter(StringRef FileName, StringRef Code, const format::FormatStyle &Style, StringRef BuildDir, HeaderSearch &HeaderSearchInfo)
std::string Path
A typedef to represent a file path.
void addExisting(Inclusion Inc)
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++ -*-===//
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))