9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERS_H 10 #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/ArrayRef.h" 21 #include "llvm/ADT/StringRef.h" 22 #include "llvm/ADT/StringSet.h" 23 #include "llvm/Support/Error.h" 24 #include "llvm/Support/VirtualFileSystem.h" 44 llvm::Expected<HeaderFile>
toHeaderFile(llvm::StringRef Header,
45 llvm::StringRef HintPath);
56 unsigned HashOffset = 0;
57 SrcMgr::CharacteristicKind FileKind = SrcMgr::C_User;
87 static_cast<uint8_t>(B));
92 return static_cast<uint8_t
>(A) & static_cast<uint8_t>(B);
118 llvm::StringMap<unsigned> includeDepth(llvm::StringRef Root)
const;
121 void recordInclude(llvm::StringRef IncludingName,
122 llvm::StringRef IncludedName,
123 llvm::StringRef IncludedRealName);
131 std::vector<std::string> RealPathNames;
132 unsigned fileIndex(llvm::StringRef
Name);
133 llvm::StringMap<unsigned> NameToIndex;
135 llvm::DenseMap<unsigned, SmallVector<unsigned, 8>> IncludeChildren;
139 std::unique_ptr<PPCallbacks>
150 HeaderSearch *HeaderSearchInfo)
151 : FileName(FileName), Code(Code), BuildDir(BuildDir),
152 HeaderSearchInfo(HeaderSearchInfo),
153 Inserter(FileName, Code, Style.IncludeStyle) {}
167 bool shouldInsertInclude(
PathRef DeclaringHeader,
181 llvm::Optional<std::string>
182 calculateIncludePath(
const HeaderFile &InsertedHeader,
183 llvm::StringRef IncludingFile)
const;
187 llvm::Optional<TextEdit> insert(llvm::StringRef VerbatimHeader)
const;
193 HeaderSearch *HeaderSearchInfo =
nullptr;
194 llvm::StringSet<> IncludedHeaders;
195 tooling::HeaderIncludes Inserter;
201 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERS_H
std::array< uint8_t, 8 > FileDigest
std::vector< const char * > Flags
llvm::StringRef PathRef
A typedef to represent a ref to file path.
Documents should not be synced at all.
DeclRelationSet operator &(DeclRelation L, DeclRelation R)
std::vector< llvm::StringRef > DirectIncludes
DeclRelationSet operator|(DeclRelation L, DeclRelation R)
llvm::StringMap< IncludeGraphNode > IncludeGraph
std::string Path
A typedef to represent a file path.
llvm::Expected< HeaderFile > toHeaderFile(llvm::StringRef Header, llvm::StringRef HintPath)
Creates a HeaderFile from Header which can be either a URI or a literal include.
static constexpr llvm::StringLiteral Name
IncludeInserter(StringRef FileName, StringRef Code, const format::FormatStyle &Style, StringRef BuildDir, HeaderSearch *HeaderSearchInfo)
The class presents a C++ symbol, e.g.
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::SmallVector< llvm::StringRef, 1 > getRankedIncludes(const Symbol &Sym)
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>.
IncludeGraphNode::SourceFlag & operator|=(IncludeGraphNode::SourceFlag &A, IncludeGraphNode::SourceFlag B)
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))