14 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_REPRESENTATION_H 15 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_REPRESENTATION_H 17 #include "clang/AST/Type.h" 18 #include "clang/Basic/Specifiers.h" 19 #include "clang/Tooling/StandaloneExecution.h" 20 #include "llvm/ADT/Optional.h" 21 #include "llvm/ADT/SmallVector.h" 22 #include "llvm/ADT/StringExtras.h" 52 auto FirstCI = std::tie(
Kind,
Text,
Name, Direction, ParamName, CloseName,
63 llvm::deref<llvm::equal>{});
71 auto FirstCI = std::tie(
Kind,
Text,
Name, Direction, ParamName, CloseName,
78 if (FirstCI < SecondCI)
81 if (FirstCI == SecondCI) {
82 return std::lexicographical_compare(
84 Other.
Children.end(), llvm::deref<llvm::less>());
102 bool Explicit =
false;
104 llvm::SmallVector<SmallString<16>, 4>
106 llvm::SmallVector<SmallString<16>, 4>
108 llvm::SmallVector<SmallString<16>, 4>
110 std::vector<std::unique_ptr<CommentInfo>>
119 : USR(USR), Name(Name), RefType(IT) {}
121 : USR(USR), Name(Name), RefType(IT), Path(Path) {}
124 return std::tie(USR,
Name, RefType) ==
141 : Type(Type, Field, IT) {}
143 : Type(Type, Field, IT, Path) {}
156 llvm::StringRef
Name)
157 :
TypeInfo(Type, Field, IT, Path), Name(Name) {}
161 :
TypeInfo(RefName, Path), Name(Name) {}
174 llvm::StringRef
Name, AccessSpecifier Access)
175 :
FieldTypeInfo(Type, Field, IT, Path, Name), Access(Access) {}
177 AccessSpecifier Access)
180 AccessSpecifier Access)
184 return std::tie(
Type,
Name, Access) ==
188 AccessSpecifier Access = AccessSpecifier::AS_none;
197 : LineNumber(LineNumber), Filename(std::move(Filename)) {}
200 return std::tie(LineNumber,
Filename) ==
209 return std::tie(LineNumber,
Filename) <
223 : USR(USR), IT(IT), Name(Name) {}
227 virtual ~
Info() =
default;
233 llvm::SmallVector<Reference, 4>
239 void mergeBase(
Info &&I);
240 bool mergeable(
const Info &Other);
242 llvm::SmallString<16> extractName();
246 llvm::Expected<Reference> getEnclosingScope();
277 llvm::SmallVector<Location, 2>
Loc;
288 bool IsMethod =
false;
291 llvm::SmallVector<FieldTypeInfo, 4>
Params;
293 AccessSpecifier Access = AccessSpecifier::AS_none;
307 TagTypeKind TagType = TagTypeKind::TTK_Struct;
310 bool IsTypeDef =
false;
311 llvm::SmallVector<MemberTypeInfo, 4>
316 llvm::SmallVector<Reference, 4>
338 llvm::SmallVector<SmallString<16>, 4>
Members;
346 llvm::Expected<std::unique_ptr<Info>>
347 mergeInfos(std::vector<std::unique_ptr<Info>> &Values);
350 tooling::ExecutionContext *
ECtx;
357 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_REPRESENTATION_H llvm::SmallVector< Reference, 4 > Namespace
MemberTypeInfo(llvm::StringRef RefName, StringRef Path, llvm::StringRef Name, AccessSpecifier Access)
Info(InfoType IT, SymbolID USR)
SymbolInfo(InfoType IT, SymbolID USR)
llvm::Optional< Location > DefLoc
NamespaceInfo(SymbolID USR, StringRef Name)
Reference(llvm::StringRef Name, StringRef Path)
std::vector< FunctionInfo > ChildFunctions
FieldTypeInfo(SymbolID Type, StringRef Field, InfoType IT, StringRef Path, llvm::StringRef Name)
llvm::SmallVector< Location, 2 > Loc
bool operator==(const TypeInfo &Other) const
std::vector< FunctionInfo > ChildFunctions
MemberTypeInfo(SymbolID Type, StringRef Field, InfoType IT, StringRef Path, llvm::StringRef Name, AccessSpecifier Access)
std::vector< EnumInfo > ChildEnums
std::vector< HeaderHandle > Path
bool operator==(const Reference &Other) const
std::vector< Reference > ChildRecords
FunctionInfo(SymbolID USR)
Reference(llvm::StringRef Name)
bool operator==(const MemberTypeInfo &Other) const
llvm::SmallVector< Reference, 4 > VirtualParents
MemberTypeInfo(llvm::StringRef RefName, llvm::StringRef Name, AccessSpecifier Access)
Location(int LineNumber, SmallString< 16 > Filename)
llvm::SmallVector< FieldTypeInfo, 4 > Params
NamespaceInfo(SymbolID USR)
std::string Filename
Filename as a string.
llvm::SmallVector< SmallString< 16 >, 4 > Members
SymbolInfo(InfoType IT, SymbolID USR, StringRef Name)
bool operator<(const Location &Other) const
std::vector< CommentInfo > Description
llvm::Expected< std::unique_ptr< Info > > mergeInfos(std::vector< std::unique_ptr< Info >> &Values)
RecordInfo(SymbolID USR, StringRef Name)
static constexpr llvm::StringLiteral Name
FieldTypeInfo(llvm::StringRef RefName, StringRef Path, llvm::StringRef Name)
TypeInfo(llvm::StringRef RefName, StringRef Path)
llvm::SmallString< 128 > Path
llvm::SmallVector< Reference, 4 > Parents
Reference(SymbolID USR, StringRef Name, InfoType IT)
std::vector< std::unique_ptr< HTMLNode > > Children
bool operator==(const Location &Other) const
tooling::ExecutionContext * ECtx
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
TypeInfo(SymbolID Type, StringRef Field, InfoType IT)
std::vector< Reference > ChildNamespaces
std::vector< Reference > ChildRecords
SmallString< 32 > Filename
std::vector< EnumInfo > ChildEnums
bool operator==(const FieldTypeInfo &Other) const
llvm::SmallVector< MemberTypeInfo, 4 > Members
Reference(SymbolID USR, StringRef Name, InfoType IT, StringRef Path)
TypeInfo(SymbolID Type, StringRef Field, InfoType IT, StringRef Path)
std::array< uint8_t, 20 > SymbolID
llvm::SmallString< 128 > Path
Info(InfoType IT, SymbolID USR, StringRef Name)
FieldTypeInfo(llvm::StringRef RefName, llvm::StringRef Name)
TypeInfo(llvm::StringRef RefName)