Index: clang-tools-extra/clang-doc/BitcodeReader.h =================================================================== --- clang-tools-extra/clang-doc/BitcodeReader.h +++ clang-tools-extra/clang-doc/BitcodeReader.h @@ -19,6 +19,7 @@ #include "BitcodeWriter.h" #include "Representation.h" #include "clang/AST/AST.h" +#include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Bitcode/BitstreamReader.h" @@ -31,7 +32,7 @@ ClangDocBitcodeReader(llvm::BitstreamCursor &Stream) : Stream(Stream) {} // Main entry point, calls readBlock to read each block in the given stream. - std::vector> readBitcode(); + llvm::Expected>> readBitcode(); private: enum class Cursor { BadBlock = 1, Record, BlockEnd, BlockBegin }; Index: clang-tools-extra/clang-doc/BitcodeReader.cpp =================================================================== --- clang-tools-extra/clang-doc/BitcodeReader.cpp +++ clang-tools-extra/clang-doc/BitcodeReader.cpp @@ -100,6 +100,8 @@ case FieldId::F_parent: case FieldId::F_vparent: case FieldId::F_type: + case FieldId::F_child_namespace: + case FieldId::F_child_record: case FieldId::F_default: Field = F; return true; @@ -372,6 +374,12 @@ case FieldId::F_namespace: I->Namespace.emplace_back(std::move(R)); break; + case FieldId::F_child_namespace: + I->ChildNamespaces.emplace_back(std::move(R)); + break; + case FieldId::F_child_record: + I->ChildRecords.emplace_back(std::move(R)); + break; default: llvm::errs() << "Invalid field type for info.\n"; exit(1); @@ -403,12 +411,40 @@ case FieldId::F_vparent: I->VirtualParents.emplace_back(std::move(R)); break; + case FieldId::F_child_namespace: + I->ChildNamespaces.emplace_back(std::move(R)); + break; + case FieldId::F_child_record: + I->ChildRecords.emplace_back(std::move(R)); + break; default: llvm::errs() << "Invalid field type for info.\n"; exit(1); } } +template +void addChild(T I, ChildInfoType &&R) { + llvm::errs() << "Invalid child type for info.\n"; + exit(1); +} + +template <> void addChild(NamespaceInfo *I, FunctionInfo &&R) { + I->ChildFunctions.emplace_back(std::move(R)); +} + +template <> void addChild(NamespaceInfo *I, EnumInfo &&R) { + I->ChildEnums.emplace_back(std::move(R)); +} + +template <> void addChild(RecordInfo *I, FunctionInfo &&R) { + I->ChildFunctions.emplace_back(std::move(R)); +} + +template <> void addChild(RecordInfo *I, EnumInfo &&R) { + I->ChildEnums.emplace_back(std::move(R)); +} + // Read records from bitcode into a given info. template bool ClangDocBitcodeReader::readRecord(unsigned ID, T I) { Record R; @@ -455,7 +491,8 @@ template bool ClangDocBitcodeReader::readSubBlock(unsigned ID, T I) { switch (ID) { - // Blocks can only have Comment, Reference, or TypeInfo subblocks + // Blocks can only have Comment, Reference, TypeInfo, FunctionInfo, or + // EnumInfo subblocks case BI_COMMENT_BLOCK_ID: if (readBlock(ID, getCommentInfo(I))) return true; @@ -492,6 +529,22 @@ } return false; } + case BI_FUNCTION_BLOCK_ID: { + FunctionInfo F; + if (readBlock(ID, &F)) { + addChild(I, std::move(F)); + return true; + } + return false; + } + case BI_ENUM_BLOCK_ID: { + EnumInfo E; + if (readBlock(ID, &E)) { + addChild(I, std::move(E)); + return true; + } + return false; + } default: llvm::errs() << "Invalid subblock type.\n"; return false; @@ -573,16 +626,21 @@ } // Entry point -std::vector> ClangDocBitcodeReader::readBitcode() { +llvm::Expected>> +ClangDocBitcodeReader::readBitcode() { std::vector> Infos; if (!validateStream()) - return Infos; + return llvm::make_error("Invalid bitcode stream.\n", + llvm::inconvertibleErrorCode()); + ; // Read the top level blocks. while (!Stream.AtEndOfStream()) { unsigned Code = Stream.ReadCode(); if (Code != llvm::bitc::ENTER_SUBBLOCK) - return Infos; + return llvm::make_error( + "Missing subblock in bitcode.\n", llvm::inconvertibleErrorCode()); + ; unsigned ID = Stream.ReadSubBlockID(); switch (ID) { @@ -592,24 +650,30 @@ case BI_MEMBER_TYPE_BLOCK_ID: case BI_COMMENT_BLOCK_ID: case BI_REFERENCE_BLOCK_ID: - llvm::errs() << "Invalid top level block.\n"; - return Infos; + return llvm::make_error( + "Invalid top level block in bitcode.\n", + llvm::inconvertibleErrorCode()); + ; case BI_NAMESPACE_BLOCK_ID: case BI_RECORD_BLOCK_ID: case BI_ENUM_BLOCK_ID: case BI_FUNCTION_BLOCK_ID: - if (std::unique_ptr I = readBlockToInfo(ID)) { + if (std::unique_ptr I = readBlockToInfo(ID)) Infos.emplace_back(std::move(I)); - } return Infos; case BI_VERSION_BLOCK_ID: if (readBlock(ID, VersionNumber)) continue; - return Infos; + return llvm::make_error( + "Invalid bitcode version in bitcode.\n", + llvm::inconvertibleErrorCode()); + ; case llvm::bitc::BLOCKINFO_BLOCK_ID: if (readBlockInfoBlock()) continue; - return Infos; + return llvm::make_error( + "Invalid BlockInfo in bitcode.\n", llvm::inconvertibleErrorCode()); + ; default: if (!Stream.SkipBlock()) continue; Index: clang-tools-extra/clang-doc/BitcodeWriter.h =================================================================== --- clang-tools-extra/clang-doc/BitcodeWriter.h +++ clang-tools-extra/clang-doc/BitcodeWriter.h @@ -68,11 +68,10 @@ // New Ids need to be added to the enum here, and to the relevant IdNameMap and // initialization list in the implementation file. -#define INFORECORDS(X) X##_USR, X##_NAME - enum RecordId { VERSION = 1, - INFORECORDS(FUNCTION), + FUNCTION_USR, + FUNCTION_NAME, FUNCTION_DEFLOCATION, FUNCTION_LOCATION, FUNCTION_ACCESS, @@ -91,13 +90,16 @@ FIELD_TYPE_NAME, MEMBER_TYPE_NAME, MEMBER_TYPE_ACCESS, - INFORECORDS(NAMESPACE), - INFORECORDS(ENUM), + NAMESPACE_USR, + NAMESPACE_NAME, + ENUM_USR, + ENUM_NAME, ENUM_DEFLOCATION, ENUM_LOCATION, ENUM_MEMBER, ENUM_SCOPED, - INFORECORDS(RECORD), + RECORD_USR, + RECORD_NAME, RECORD_DEFLOCATION, RECORD_LOCATION, RECORD_TAG_TYPE, @@ -112,10 +114,16 @@ static constexpr unsigned BlockIdCount = BI_LAST - BI_FIRST; static constexpr unsigned RecordIdCount = RI_LAST - RI_FIRST; -#undef INFORECORDS - // Identifiers for differentiating between subblocks -enum class FieldId { F_default, F_namespace, F_parent, F_vparent, F_type }; +enum class FieldId { + F_default, + F_namespace, + F_parent, + F_vparent, + F_type, + F_child_namespace, + F_child_record +}; class ClangDocBitcodeWriter { public: Index: clang-tools-extra/clang-doc/BitcodeWriter.cpp =================================================================== --- clang-tools-extra/clang-doc/BitcodeWriter.cpp +++ clang-tools-extra/clang-doc/BitcodeWriter.cpp @@ -434,6 +434,14 @@ emitBlock(N, FieldId::F_namespace); for (const auto &CI : I.Description) emitBlock(CI); + for (const auto &C : I.ChildNamespaces) + emitBlock(C, FieldId::F_child_namespace); + for (const auto &C : I.ChildRecords) + emitBlock(C, FieldId::F_child_record); + for (const auto &C : I.ChildFunctions) + emitBlock(C); + for (const auto &C : I.ChildEnums) + emitBlock(C); } void ClangDocBitcodeWriter::emitBlock(const EnumInfo &I) { @@ -472,6 +480,14 @@ emitBlock(P, FieldId::F_parent); for (const auto &P : I.VirtualParents) emitBlock(P, FieldId::F_vparent); + for (const auto &C : I.ChildNamespaces) + emitBlock(C, FieldId::F_child_namespace); + for (const auto &C : I.ChildRecords) + emitBlock(C, FieldId::F_child_record); + for (const auto &C : I.ChildFunctions) + emitBlock(C); + for (const auto &C : I.ChildEnums) + emitBlock(C); } void ClangDocBitcodeWriter::emitBlock(const FunctionInfo &I) { Index: clang-tools-extra/clang-doc/Mapper.cpp =================================================================== --- clang-tools-extra/clang-doc/Mapper.cpp +++ clang-tools-extra/clang-doc/Mapper.cpp @@ -33,10 +33,11 @@ if (index::generateUSRForDecl(D, USR)) return true; - ECtx->reportResult(llvm::toHex(llvm::toStringRef(serialize::hashUSR(USR))), - serialize::emitInfo(D, getComment(D, D->getASTContext()), - getLine(D, D->getASTContext()), - getFile(D, D->getASTContext()))); + std::unique_ptr I = serialize::emitInfo( + D, getComment(D, D->getASTContext()), getLine(D, D->getASTContext()), + getFile(D, D->getASTContext())); + ECtx->reportResult(llvm::toHex(llvm::toStringRef(I->USR)), + serialize::serialize(I)); return true; } Index: clang-tools-extra/clang-doc/Representation.h =================================================================== --- clang-tools-extra/clang-doc/Representation.h +++ clang-tools-extra/clang-doc/Representation.h @@ -30,6 +30,9 @@ using SymbolID = std::array; struct Info; +struct FunctionInfo; +struct EnumInfo; + enum class InfoType { IT_default, IT_namespace, @@ -152,6 +155,9 @@ struct Info { Info() = default; Info(InfoType IT) : IT(IT) {} + Info(InfoType IT, SymbolID USR) : USR(USR), IT(IT) {} + Info(InfoType IT, SymbolID USR, StringRef Name) + : USR(USR), IT(IT), Name(Name) {} Info(const Info &Other) = delete; Info(Info &&Other) = default; @@ -165,18 +171,32 @@ void mergeBase(Info &&I); bool mergeable(const Info &Other); + + // Returns a reference to the parent scope (that is, the immediate parent + // namespace or class in which this decl resides). + llvm::Expected getEnclosingScope(); }; // Info for namespaces. struct NamespaceInfo : public Info { NamespaceInfo() : Info(InfoType::IT_namespace) {} + NamespaceInfo(SymbolID USR) : Info(InfoType::IT_namespace, USR) {} + NamespaceInfo(SymbolID USR, StringRef Name) + : Info(InfoType::IT_namespace, USR, Name) {} void merge(NamespaceInfo &&I); + + std::vector ChildNamespaces; + std::vector ChildRecords; + std::vector ChildFunctions; + std::vector ChildEnums; }; // Info for symbols. struct SymbolInfo : public Info { SymbolInfo(InfoType IT) : Info(IT) {} + SymbolInfo(InfoType IT, SymbolID USR) : Info(IT, USR) {} + SymbolInfo(InfoType IT, SymbolID USR, StringRef Name) : Info(IT, USR, Name) {} void merge(SymbolInfo &&I); @@ -188,6 +208,7 @@ // Info for functions. struct FunctionInfo : public SymbolInfo { FunctionInfo() : SymbolInfo(InfoType::IT_function) {} + FunctionInfo(SymbolID USR) : SymbolInfo(InfoType::IT_function, USR) {} void merge(FunctionInfo &&I); @@ -204,6 +225,9 @@ // Info for types. struct RecordInfo : public SymbolInfo { RecordInfo() : SymbolInfo(InfoType::IT_record) {} + RecordInfo(SymbolID USR) : SymbolInfo(InfoType::IT_record, USR) {} + RecordInfo(SymbolID USR, StringRef Name) + : SymbolInfo(InfoType::IT_record, USR, Name) {} void merge(RecordInfo &&I); @@ -217,12 +241,18 @@ // parents). llvm::SmallVector VirtualParents; // List of virtual base/parent records. + + std::vector ChildNamespaces; + std::vector ChildRecords; + std::vector ChildFunctions; + std::vector ChildEnums; }; // TODO: Expand to allow for documenting templating. // Info for types. struct EnumInfo : public SymbolInfo { EnumInfo() : SymbolInfo(InfoType::IT_enum) {} + EnumInfo(SymbolID USR) : SymbolInfo(InfoType::IT_enum, USR) {} void merge(EnumInfo &&I); Index: clang-tools-extra/clang-doc/Representation.cpp =================================================================== --- clang-tools-extra/clang-doc/Representation.cpp +++ clang-tools-extra/clang-doc/Representation.cpp @@ -26,23 +26,76 @@ namespace clang { namespace doc { -static const SymbolID EmptySID = SymbolID(); +namespace { + +const SymbolID EmptySID = SymbolID(); template -std::unique_ptr reduce(std::vector> &Values) { - std::unique_ptr Merged = llvm::make_unique(); +llvm::Expected> +reduce(std::vector> &Values) { + if (Values.empty()) + return llvm::make_error(" No values to reduce.\n", + llvm::inconvertibleErrorCode()); + std::unique_ptr Merged = llvm::make_unique(Values[0]->USR); T *Tmp = static_cast(Merged.get()); for (auto &I : Values) Tmp->merge(std::move(*static_cast(I.get()))); return Merged; } +// Return the index of the matching child in the vector, or -1 if merge is not +// necessary. +template +int isChildMergeNecessary(std::vector &Children, T &ChildToMerge) { + for (unsigned long I = 0; I < Children.size(); I++) { + if (ChildToMerge.USR == Children[I].USR) + return I; + } + return -1; +} + +// For References, we don't need to actually merge them, we just don't want +// duplicates. +void reduceChildren(std::vector &Children, + std::vector &&ChildrenToMerge) { + for (auto &ChildToMerge : ChildrenToMerge) { + if (isChildMergeNecessary(Children, ChildToMerge) == -1) + Children.push_back(std::move(ChildToMerge)); + } +} + +void reduceChildren(std::vector &Children, + std::vector &&ChildrenToMerge) { + for (auto &ChildToMerge : ChildrenToMerge) { + int mergeIdx = isChildMergeNecessary(Children, ChildToMerge); + if (mergeIdx == -1) { + Children.push_back(std::move(ChildToMerge)); + continue; + } + Children[mergeIdx].merge(std::move(ChildToMerge)); + } +} + +void reduceChildren(std::vector &Children, + std::vector &&ChildrenToMerge) { + for (auto &ChildToMerge : ChildrenToMerge) { + int mergeIdx = isChildMergeNecessary(Children, ChildToMerge); + if (mergeIdx == -1) { + Children.push_back(std::move(ChildToMerge)); + continue; + } + Children[mergeIdx].merge(std::move(ChildToMerge)); + } +} + +} // namespace + // Dispatch function. llvm::Expected> mergeInfos(std::vector> &Values) { if (Values.empty()) return llvm::make_error("No info values to merge.\n", - llvm::inconvertibleErrorCode()); + llvm::inconvertibleErrorCode()); switch (Values[0]->IT) { case InfoType::IT_namespace: @@ -73,7 +126,7 @@ } bool Info::mergeable(const Info &Other) { - return IT == Other.IT && (USR == EmptySID || USR == Other.USR); + return IT == Other.IT && USR == Other.USR; } void SymbolInfo::merge(SymbolInfo &&Other) { @@ -87,6 +140,11 @@ void NamespaceInfo::merge(NamespaceInfo &&Other) { assert(mergeable(Other)); + // Reduce children if necessary + reduceChildren(ChildNamespaces, std::move(Other.ChildNamespaces)); + reduceChildren(ChildRecords, std::move(Other.ChildRecords)); + reduceChildren(ChildFunctions, std::move(Other.ChildFunctions)); + reduceChildren(ChildEnums, std::move(Other.ChildEnums)); mergeBase(std::move(Other)); } @@ -100,6 +158,13 @@ Parents = std::move(Other.Parents); if (VirtualParents.empty()) VirtualParents = std::move(Other.VirtualParents); + // Unconditionally extend the children, since they're added after the + // initial reduce and therefore there can only be one. + // Reduce children if necessary + reduceChildren(ChildNamespaces, std::move(Other.ChildNamespaces)); + reduceChildren(ChildRecords, std::move(Other.ChildRecords)); + reduceChildren(ChildFunctions, std::move(Other.ChildFunctions)); + reduceChildren(ChildEnums, std::move(Other.ChildEnums)); SymbolInfo::merge(std::move(Other)); } Index: clang-tools-extra/clang-doc/Serialize.h =================================================================== --- clang-tools-extra/clang-doc/Serialize.h +++ clang-tools-extra/clang-doc/Serialize.h @@ -28,16 +28,16 @@ namespace doc { namespace serialize { -std::string emitInfo(const NamespaceDecl *D, const FullComment *FC, - int LineNumber, StringRef File); -std::string emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber, - StringRef File); -std::string emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber, - StringRef File); -std::string emitInfo(const FunctionDecl *D, const FullComment *FC, - int LineNumber, StringRef File); -std::string emitInfo(const CXXMethodDecl *D, const FullComment *FC, - int LineNumber, StringRef File); +std::unique_ptr emitInfo(const NamespaceDecl *D, const FullComment *FC, + int LineNumber, StringRef File); +std::unique_ptr emitInfo(const RecordDecl *D, const FullComment *FC, + int LineNumber, StringRef File); +std::unique_ptr emitInfo(const EnumDecl *D, const FullComment *FC, + int LineNumber, StringRef File); +std::unique_ptr emitInfo(const FunctionDecl *D, const FullComment *FC, + int LineNumber, StringRef File); +std::unique_ptr emitInfo(const CXXMethodDecl *D, const FullComment *FC, + int LineNumber, StringRef File); // Function to hash a given USR value for storage. // As USRs (Unified Symbol Resolution) could be large, especially for functions @@ -46,6 +46,8 @@ // memory (vs storing USRs directly). SymbolID hashUSR(llvm::StringRef USR); +std::string serialize(std::unique_ptr &I); + } // namespace serialize } // namespace doc } // namespace clang Index: clang-tools-extra/clang-doc/Serialize.cpp =================================================================== --- clang-tools-extra/clang-doc/Serialize.cpp +++ clang-tools-extra/clang-doc/Serialize.cpp @@ -152,6 +152,21 @@ return Buffer.str().str(); } +std::string serialize(std::unique_ptr &I) { + switch (I->IT) { + case InfoType::IT_namespace: + return serialize(*static_cast(I.get())); + case InfoType::IT_record: + return serialize(*static_cast(I.get())); + case InfoType::IT_enum: + return serialize(*static_cast(I.get())); + case InfoType::IT_function: + return serialize(*static_cast(I.get())); + default: + return ""; + } +} + static void parseFullComment(const FullComment *C, CommentInfo &CI) { ClangDocCommentVisitor Visitor(CI); Visitor.parseComment(C); @@ -294,50 +309,97 @@ parseParameters(I, D); } -std::string emitInfo(const NamespaceDecl *D, const FullComment *FC, - int LineNumber, llvm::StringRef File) { - NamespaceInfo I; - populateInfo(I, D, FC); - return serialize(I); +std::unique_ptr emitInfo(const NamespaceDecl *D, const FullComment *FC, + int LineNumber, llvm::StringRef File) { + std::unique_ptr IPtr = llvm::make_unique(); + NamespaceInfo *I = static_cast(IPtr.get()); + populateInfo(*I, D, FC); + return IPtr; } -std::string emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber, - llvm::StringRef File) { - RecordInfo I; - populateSymbolInfo(I, D, FC, LineNumber, File); - I.TagType = D->getTagKind(); - parseFields(I, D); +std::unique_ptr emitInfo(const RecordDecl *D, const FullComment *FC, + int LineNumber, llvm::StringRef File) { + std::unique_ptr IPtr = llvm::make_unique(); + RecordInfo *I = static_cast(IPtr.get()); + populateSymbolInfo(*I, D, FC, LineNumber, File); + I->TagType = D->getTagKind(); + parseFields(*I, D); if (const auto *C = dyn_cast(D)) - parseBases(I, C); - return serialize(I); -} - -std::string emitInfo(const FunctionDecl *D, const FullComment *FC, - int LineNumber, llvm::StringRef File) { - FunctionInfo I; - populateFunctionInfo(I, D, FC, LineNumber, File); - I.Access = clang::AccessSpecifier::AS_none; - return serialize(I); -} - -std::string emitInfo(const CXXMethodDecl *D, const FullComment *FC, - int LineNumber, llvm::StringRef File) { - FunctionInfo I; - populateFunctionInfo(I, D, FC, LineNumber, File); - I.IsMethod = true; - I.Parent = Reference{getUSRForDecl(D->getParent()), - D->getParent()->getNameAsString(), InfoType::IT_record}; - I.Access = D->getAccess(); - return serialize(I); -} - -std::string emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber, - llvm::StringRef File) { - EnumInfo I; - populateSymbolInfo(I, D, FC, LineNumber, File); - I.Scoped = D->isScoped(); - parseEnumerators(I, D); - return serialize(I); + parseBases(*I, C); + return IPtr; +} + +std::unique_ptr emitInfo(const FunctionDecl *D, const FullComment *FC, + int LineNumber, llvm::StringRef File) { + FunctionInfo Func; + populateFunctionInfo(Func, D, FC, LineNumber, File); + Func.Access = clang::AccessSpecifier::AS_none; + + // Wrap in enclosing scope + std::unique_ptr IPtr = llvm::make_unique(); + NamespaceInfo *I = static_cast(IPtr.get()); + if (!Func.Namespace.empty()) + I->USR = Func.Namespace[0].USR; + else + I->USR = SymbolID(); + I->ChildFunctions.push_back(std::move(Func)); + return IPtr; +} + +std::unique_ptr emitInfo(const CXXMethodDecl *D, const FullComment *FC, + int LineNumber, llvm::StringRef File) { + FunctionInfo Func; + populateFunctionInfo(Func, D, FC, LineNumber, File); + Func.IsMethod = true; + + SymbolID ParentUSR = getUSRForDecl(D->getParent()); + Func.Parent = Reference{ParentUSR, D->getParent()->getNameAsString(), + InfoType::IT_record}; + Func.Access = D->getAccess(); + + // Wrap in enclosing scope + std::unique_ptr IPtr = llvm::make_unique(); + RecordInfo *I = static_cast(IPtr.get()); + I->USR = ParentUSR; + I->ChildFunctions.push_back(std::move(Func)); + return IPtr; +} + +std::unique_ptr emitInfo(const EnumDecl *D, const FullComment *FC, + int LineNumber, llvm::StringRef File) { + EnumInfo Enum; + populateSymbolInfo(Enum, D, FC, LineNumber, File); + Enum.Scoped = D->isScoped(); + parseEnumerators(Enum, D); + + // Wrap in enclosing scope + if (!Enum.Namespace.empty()) { + switch (Enum.Namespace[0].RefType) { + case InfoType::IT_namespace: { + std::unique_ptr IPtr = llvm::make_unique(); + NamespaceInfo *I = static_cast(IPtr.get()); + I->USR = Enum.Namespace[0].USR; + I->ChildEnums.push_back(std::move(Enum)); + return IPtr; + } + case InfoType::IT_record: { + std::unique_ptr IPtr = llvm::make_unique(); + RecordInfo *I = static_cast(IPtr.get()); + I->USR = Enum.Namespace[0].USR; + I->ChildEnums.push_back(std::move(Enum)); + return IPtr; + } + default: + break; + } + } + + // Put in global namespace + std::unique_ptr IPtr = llvm::make_unique(); + NamespaceInfo *I = static_cast(IPtr.get()); + I->USR = SymbolID(); + I->ChildEnums.push_back(std::move(Enum)); + return IPtr; } } // namespace serialize Index: clang-tools-extra/clang-doc/YAMLGenerator.cpp =================================================================== --- clang-tools-extra/clang-doc/YAMLGenerator.cpp +++ clang-tools-extra/clang-doc/YAMLGenerator.cpp @@ -20,6 +20,8 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(Reference) LLVM_YAML_IS_SEQUENCE_VECTOR(Location) LLVM_YAML_IS_SEQUENCE_VECTOR(CommentInfo) +LLVM_YAML_IS_SEQUENCE_VECTOR(FunctionInfo) +LLVM_YAML_IS_SEQUENCE_VECTOR(EnumInfo) LLVM_YAML_IS_SEQUENCE_VECTOR(std::unique_ptr) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::SmallString<16>) @@ -175,7 +177,14 @@ }; template <> struct MappingTraits { - static void mapping(IO &IO, NamespaceInfo &I) { InfoMapping(IO, I); } + static void mapping(IO &IO, NamespaceInfo &I) { + InfoMapping(IO, I); + IO.mapOptional("ChildNamespaces", I.ChildNamespaces, + std::vector()); + IO.mapOptional("ChildRecords", I.ChildRecords, std::vector()); + IO.mapOptional("ChildFunctions", I.ChildFunctions); + IO.mapOptional("ChildEnums", I.ChildEnums); + } }; template <> struct MappingTraits { @@ -186,6 +195,11 @@ IO.mapOptional("Parents", I.Parents, llvm::SmallVector()); IO.mapOptional("VirtualParents", I.VirtualParents, llvm::SmallVector()); + IO.mapOptional("ChildNamespaces", I.ChildNamespaces, + std::vector()); + IO.mapOptional("ChildRecords", I.ChildRecords, std::vector()); + IO.mapOptional("ChildFunctions", I.ChildFunctions); + IO.mapOptional("ChildEnums", I.ChildEnums); } }; Index: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp =================================================================== --- clang-tools-extra/clang-doc/tool/ClangDocMain.cpp +++ clang-tools-extra/clang-doc/tool/ClangDocMain.cpp @@ -117,9 +117,24 @@ return false; } +// A function to extract the appropriate path name for a given info's +// documentation. The path returned is a composite of the parent namespaces as +// directories plus the decl name as the filename. +// +// Example: Given the below, the path for class C will be < +// root>/A/B/C. +// +// namespace A { +// namesapce B { +// +// class C {}; +// +// } +// } llvm::Expected> -getPath(StringRef Root, StringRef Ext, StringRef Name, - llvm::SmallVectorImpl &Namespaces) { +getInfoOutputFile(StringRef Root, + llvm::SmallVectorImpl &Namespaces, + StringRef Name, StringRef Ext) { std::error_code OK; llvm::SmallString<128> Path; llvm::sys::path::native(Root, Path); @@ -130,6 +145,8 @@ return llvm::make_error("Unable to create directory.\n", llvm::inconvertibleErrorCode()); + if (Name.empty()) + Name = "GlobalNamespace"; llvm::sys::path::append(Path, Name + Ext); return Path; } @@ -142,6 +159,30 @@ llvm_unreachable("Unknown OutputFormatTy"); } +// Iterate through tool results and build string map of info vectors from the +// encoded bitstreams. +bool bitcodeResultsToInfos( + tooling::ToolResults &Results, + llvm::StringMap>> &Output) { + bool Err = false; + Results.forEachResult([&](StringRef Key, StringRef Value) { + llvm::BitstreamCursor Stream(Value); + doc::ClangDocBitcodeReader Reader(Stream); + auto Infos = Reader.readBitcode(); + if (!Infos) { + llvm::errs() << toString(Infos.takeError()) << "\n"; + Err = true; + return; + } + for (auto &I : Infos.get()) { + auto R = + Output.try_emplace(Key, std::vector>()); + R.first->second.emplace_back(std::move(I)); + } + }); + return Err; +} + int main(int argc, const char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); std::error_code OK; @@ -191,30 +232,21 @@ } // Collect values into output by key. - llvm::outs() << "Collecting infos...\n"; - llvm::StringMap>> MapOutput; - // In ToolResults, the Key is the hashed USR and the value is the // bitcode-encoded representation of the Info object. - Exec->get()->getToolResults()->forEachResult([&](StringRef Key, - StringRef Value) { - llvm::BitstreamCursor Stream(Value); - doc::ClangDocBitcodeReader Reader(Stream); - auto Infos = Reader.readBitcode(); - for (auto &I : Infos) { - auto R = - MapOutput.try_emplace(Key, std::vector>()); - R.first->second.emplace_back(std::move(I)); - } - }); + llvm::outs() << "Collecting infos...\n"; + llvm::StringMap>> USRToInfos; + if (bitcodeResultsToInfos(*Exec->get()->getToolResults(), USRToInfos)) + return 1; - // Reducing and generation phases - llvm::outs() << "Reducing " << MapOutput.size() << " infos...\n"; - llvm::StringMap> ReduceOutput; - for (auto &Group : MapOutput) { + // First reducing phase (reduce all decls into one info per decl). + llvm::outs() << "Reducing " << USRToInfos.size() << " infos...\n"; + for (auto &Group : USRToInfos) { auto Reduced = doc::mergeInfos(Group.getValue()); - if (!Reduced) + if (!Reduced) { llvm::errs() << llvm::toString(Reduced.takeError()); + continue; + } if (DumpIntermediateResult) { SmallString<4096> Buffer; @@ -225,10 +257,10 @@ llvm::errs() << "Error dumping to bitcode.\n"; continue; } - - // Create the relevant ostream and emit the documentation for this decl. doc::Info *I = Reduced.get().get(); - auto InfoPath = getPath(OutDirectory, "." + Format, I->Name, I->Namespace); + + auto InfoPath = + getInfoOutputFile(OutDirectory, I->Namespace, I->Name, "." + Format); if (!InfoPath) { llvm::errs() << toString(InfoPath.takeError()) << "\n"; continue; @@ -236,7 +268,7 @@ std::error_code FileErr; llvm::raw_fd_ostream InfoOS(InfoPath.get(), FileErr, llvm::sys::fs::F_None); if (FileErr != OK) { - llvm::errs() << "Error opening index file: " << FileErr.message() << "\n"; + llvm::errs() << "Error opening info file: " << FileErr.message() << "\n"; continue; } Index: clang-tools-extra/test/clang-doc/bc-comment.cpp =================================================================== --- clang-tools-extra/test/clang-doc/bc-comment.cpp +++ clang-tools-extra/test/clang-doc/bc-comment.cpp @@ -2,9 +2,7 @@ // RUN: mkdir %t // RUN: echo "" > %t/compile_flags.txt // RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-intermediate -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/7574630614A535710E5A6ABCFFF98BCA2D06A4CA.bc --dump | FileCheck %s - + /// \brief Brief description. /// /// Extended description that @@ -26,172 +24,178 @@ /// Bonus comment on definition void F(int I, int J) {} -// CHECK: -// CHECK-NEXT: - // CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'F' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'FullComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'BlockCommandComment' - // CHECK-NEXT: blob data = 'brief' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' Brief description.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' Extended description that' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' continues onto the next line.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'HTMLStartTagComment' - // CHECK-NEXT: blob data = 'ul' - // CHECK-NEXT: blob data = 'class' - // CHECK-NEXT: blob data = 'test' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'HTMLStartTagComment' - // CHECK-NEXT: blob data = 'li' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' Testing.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'HTMLEndTagComment' - // CHECK-NEXT: blob data = 'ul' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'VerbatimBlockComment' - // CHECK-NEXT: blob data = 'verbatim' - // CHECK-NEXT: blob data = 'endverbatim' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'VerbatimBlockLineComment' - // CHECK-NEXT: blob data = ' The description continues.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' --' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParamCommandComment' - // CHECK-NEXT: blob data = '[out]' - // CHECK-NEXT: blob data = 'I' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' is a parameter.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParamCommandComment' - // CHECK-NEXT: blob data = '[in]' - // CHECK-NEXT: blob data = 'J' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' is a parameter.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'BlockCommandComment' - // CHECK-NEXT: blob data = 'return' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' void' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'FullComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' Bonus comment on definition' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = '{{.*}}' - // CHECK-NEXT: blob data = '{{.*}}' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'void' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'I' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'J' - // CHECK-NEXT: -// CHECK-NEXT: +// RUN: clang-doc --dump-intermediate --doxygen -p %t %t/test.cpp -output=%t/docs + + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/0000000000000000000000000000000000000000.bc | FileCheck %s --check-prefix CHECK-0 +// CHECK-0: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'F' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'FullComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'BlockCommandComment' +// CHECK-0-NEXT: blob data = 'brief' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: blob data = ' Brief description.' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: blob data = ' Extended description that' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: blob data = ' continues onto the next line.' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'HTMLStartTagComment' +// CHECK-0-NEXT: blob data = 'ul' +// CHECK-0-NEXT: blob data = 'class' +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'HTMLStartTagComment' +// CHECK-0-NEXT: blob data = 'li' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: blob data = ' Testing.' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'HTMLEndTagComment' +// CHECK-0-NEXT: blob data = 'ul' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'VerbatimBlockComment' +// CHECK-0-NEXT: blob data = 'verbatim' +// CHECK-0-NEXT: blob data = 'endverbatim' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'VerbatimBlockLineComment' +// CHECK-0-NEXT: blob data = ' The description continues.' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: blob data = ' --' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParamCommandComment' +// CHECK-0-NEXT: blob data = '[out]' +// CHECK-0-NEXT: blob data = 'I' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: blob data = ' is a parameter.' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParamCommandComment' +// CHECK-0-NEXT: blob data = '[in]' +// CHECK-0-NEXT: blob data = 'J' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: blob data = ' is a parameter.' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'BlockCommandComment' +// CHECK-0-NEXT: blob data = 'return' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: blob data = ' void' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'FullComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: blob data = ' Bonus comment on definition' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'void' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'int' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'I' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'int' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'J' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: Index: clang-tools-extra/test/clang-doc/bc-namespace.cpp =================================================================== --- clang-tools-extra/test/clang-doc/bc-namespace.cpp +++ clang-tools-extra/test/clang-doc/bc-namespace.cpp @@ -2,18 +2,8 @@ // RUN: mkdir %t // RUN: echo "" > %t/compile_flags.txt // RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-intermediate -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/8D042EFFC98B373450BC6B5B90A330C25A150E9C.bc --dump | FileCheck %s --check-prefix CHECK-A -// RUN: llvm-bcanalyzer %t/docs/bc/E21AF79E2A9D02554BA090D10DF39FE273F5CDB5.bc --dump | FileCheck %s --check-prefix CHECK-B -// RUN: llvm-bcanalyzer %t/docs/bc/39D3C95A5F7CE2BA4937BD7B01BAE09EBC2AD8AC.bc --dump | FileCheck %s --check-prefix CHECK-F -// RUN: llvm-bcanalyzer %t/docs/bc/9A82CB33ED0FDF81EE383D31CD0957D153C5E840.bc --dump | FileCheck %s --check-prefix CHECK-FUNC -// RUN: llvm-bcanalyzer %t/docs/bc/E9ABF7E7E2425B626723D41E76E4BC7E7A5BD775.bc --dump | FileCheck %s --check-prefix CHECK-E - + namespace A { -// CHECK-A: - // CHECK-A-NEXT: - // CHECK-A-NEXT: blob data = 'A' -// CHECK-A-NEXT: void f(); @@ -22,88 +12,107 @@ namespace A { void f(){}; -// CHECK-F: - // CHECK-F-NEXT: - // CHECK-F-NEXT: blob data = 'f' - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: blob data = 'A' - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: blob data = '{{.*}}' - // CHECK-F-NEXT: blob data = '{{.*}}' - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: blob data = 'void' - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: -// CHECK-F-NEXT: namespace B { -// CHECK-B: - // CHECK-B-NEXT: - // CHECK-B-NEXT: blob data = 'B' - // CHECK-B-NEXT: - // CHECK-B-NEXT: - // CHECK-B-NEXT: blob data = 'A' - // CHECK-B-NEXT: - // CHECK-B-NEXT: - // CHECK-B-NEXT: -// CHECK-B-NEXT: enum E { X }; -// CHECK-E: - // CHECK-E-NEXT: - // CHECK-E-NEXT: blob data = 'E' - // CHECK-E-NEXT: - // CHECK-E-NEXT: - // CHECK-E-NEXT: blob data = 'B' - // CHECK-E-NEXT: - // CHECK-E-NEXT: - // CHECK-E-NEXT: - // CHECK-E-NEXT: - // CHECK-E-NEXT: - // CHECK-E-NEXT: blob data = 'A' - // CHECK-E-NEXT: - // CHECK-E-NEXT: - // CHECK-E-NEXT: - // CHECK-E-NEXT: blob data = '{{.*}}' - // CHECK-E-NEXT: blob data = 'X' -// CHECK-E-NEXT: E func(int i) { return X; } -// CHECK-FUNC: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: blob data = 'func' - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: blob data = 'B' - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: blob data = 'A' - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: blob data = '{{.*}}' - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: blob data = 'enum A::B::E' - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: blob data = 'int' - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: - // CHECK-FUNC-NEXT: blob data = 'i' - // CHECK-FUNC-NEXT: -// CHECK-FUNC-NEXT: } // namespace B } // namespace A + +// RUN: clang-doc --dump-intermediate --doxygen -p %t %t/test.cpp -output=%t/docs + + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/8D042EFFC98B373450BC6B5B90A330C25A150E9C.bc | FileCheck %s --check-prefix CHECK-0 +// CHECK-0: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'A' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'f' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'A' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'void' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/E21AF79E2A9D02554BA090D10DF39FE273F5CDB5.bc | FileCheck %s --check-prefix CHECK-1 +// CHECK-1: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'B' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'A' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'func' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'B' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'A' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = '{{.*}}' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'enum A::B::E' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'int' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'i' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'E' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'B' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'A' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = '{{.*}}' +// CHECK-1-NEXT: blob data = 'X' +// CHECK-1-NEXT: +// CHECK-1-NEXT: Index: clang-tools-extra/test/clang-doc/bc-record.cpp =================================================================== --- clang-tools-extra/test/clang-doc/bc-record.cpp +++ clang-tools-extra/test/clang-doc/bc-record.cpp @@ -1,120 +1,23 @@ -// This test requires Linux due to the system-dependent USR for the -// inner class in function H. +// This test requires Linux due to system-dependent USR for the inner class. // REQUIRES: system-linux // RUN: rm -rf %t // RUN: mkdir %t // RUN: echo "" > %t/compile_flags.txt // RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-intermediate -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/ACE81AFA6627B4CEF2B456FB6E1252925674AF7E.bc --dump | FileCheck %s --check-prefix CHECK-A -// RUN: llvm-bcanalyzer %t/docs/bc/FC07BD34D5E77782C263FA944447929EA8753740.bc --dump | FileCheck %s --check-prefix CHECK-B -// RUN: llvm-bcanalyzer %t/docs/bc/1E3438A08BA22025C0B46289FF0686F92C8924C5.bc --dump | FileCheck %s --check-prefix CHECK-BC -// RUN: llvm-bcanalyzer %t/docs/bc/06B5F6A19BA9F6A832E127C9968282B94619B210.bc --dump | FileCheck %s --check-prefix CHECK-C -// RUN: llvm-bcanalyzer %t/docs/bc/0921737541208B8FA9BB42B60F78AC1D779AA054.bc --dump | FileCheck %s --check-prefix CHECK-D -// RUN: llvm-bcanalyzer %t/docs/bc/289584A8E0FF4178A794622A547AA622503967A1.bc --dump | FileCheck %s --check-prefix CHECK-E -// RUN: llvm-bcanalyzer %t/docs/bc/DEB4AC1CD9253CD9EF7FBE6BCAC506D77984ABD4.bc --dump | FileCheck %s --check-prefix CHECK-ECON -// RUN: llvm-bcanalyzer %t/docs/bc/BD2BDEBD423F80BACCEA75DE6D6622D355FC2D17.bc --dump | FileCheck %s --check-prefix CHECK-EDES -// RUN: llvm-bcanalyzer %t/docs/bc/E3B54702FABFF4037025BA194FC27C47006330B5.bc --dump | FileCheck %s --check-prefix CHECK-F -// RUN: llvm-bcanalyzer %t/docs/bc/B6AC4C5C9F2EA3F2B3ECE1A33D349F4EE502B24E.bc --dump | FileCheck %s --check-prefix CHECK-H -// RUN: llvm-bcanalyzer %t/docs/bc/6BA1EE2B3DAEACF6E4306F10AF44908F4807927C.bc --dump | FileCheck %s --check-prefix CHECK-I -// RUN: llvm-bcanalyzer %t/docs/bc/5093D428CDC62096A67547BA52566E4FB9404EEE.bc --dump | FileCheck %s --check-prefix CHECK-PM -// RUN: llvm-bcanalyzer %t/docs/bc/CA7C7935730B5EACD25F080E9C83FA087CCDC75E.bc --dump | FileCheck %s --check-prefix CHECK-X -// RUN: llvm-bcanalyzer %t/docs/bc/641AB4A3D36399954ACDE29C7A8833032BF40472.bc --dump | FileCheck %s --check-prefix CHECK-Y void H() { class I {}; } -// CHECK-H: - // CHECK-H-NEXT: - // CHECK-H-NEXT: blob data = 'H' - // CHECK-H-NEXT: blob data = '{{.*}}' - // CHECK-H-NEXT: - // CHECK-H-NEXT: - // CHECK-H-NEXT: blob data = 'void' - // CHECK-H-NEXT: - // CHECK-H-NEXT: - // CHECK-H-NEXT: -// CHECK-H-NEXT: - - -// CHECK-I: - // CHECK-I-NEXT: - // CHECK-I-NEXT: blob data = 'I' - // CHECK-I-NEXT: - // CHECK-I-NEXT: - // CHECK-I-NEXT: blob data = 'H' - // CHECK-I-NEXT: - // CHECK-I-NEXT: - // CHECK-I-NEXT: - // CHECK-I-NEXT: blob data = '{{.*}}' - // CHECK-I-NEXT: -// CHECK-I-NEXT: union A { int X; int Y; }; -// CHECK-A: - // CHECK-A-NEXT: - // CHECK-A-NEXT: blob data = 'A' - // CHECK-A-NEXT: blob data = '{{.*}}' - // CHECK-A-NEXT: - // CHECK-A-NEXT: - // CHECK-A-NEXT: - // CHECK-A-NEXT: blob data = 'int' - // CHECK-A-NEXT: - // CHECK-A-NEXT: - // CHECK-A-NEXT: blob data = 'X' - // CHECK-A-NEXT: - // CHECK-A-NEXT: - // CHECK-A-NEXT: - // CHECK-A-NEXT: - // CHECK-A-NEXT: blob data = 'int' - // CHECK-A-NEXT: - // CHECK-A-NEXT: - // CHECK-A-NEXT: blob data = 'Y' - // CHECK-A-NEXT: - // CHECK-A-NEXT: -// CHECK-A-NEXT: enum B { X, Y }; -// CHECK-B: - // CHECK-B-NEXT: - // CHECK-B-NEXT: blob data = 'B' - // CHECK-B-NEXT: blob data = '{{.*}}' - // CHECK-B-NEXT: blob data = 'X' - // CHECK-B-NEXT: blob data = 'Y' -// CHECK-B-NEXT: enum class Bc { A, B }; -// CHECK-BC: - // CHECK-BC-NEXT: - // CHECK-BC-NEXT: blob data = 'Bc' - // CHECK-BC-NEXT: blob data = '{{.*}}' - // CHECK-BC-NEXT: - // CHECK-BC-NEXT: blob data = 'A' - // CHECK-BC-NEXT: blob data = 'B' -// CHECK-BC-NEXT: struct C { int i; }; -// CHECK-C: - // CHECK-C-NEXT: - // CHECK-C-NEXT: blob data = 'C' - // CHECK-C-NEXT: blob data = '{{.*}}' - // CHECK-C-NEXT: - // CHECK-C-NEXT: - // CHECK-C-NEXT: blob data = 'int' - // CHECK-C-NEXT: - // CHECK-C-NEXT: - // CHECK-C-NEXT: blob data = 'i' - // CHECK-C-NEXT: - // CHECK-C-NEXT: -// CHECK-C-NEXT: class D {}; -// CHECK-D: - // CHECK-D-NEXT: - // CHECK-D-NEXT: blob data = 'D' - // CHECK-D-NEXT: blob data = '{{.*}}' - // CHECK-D-NEXT: -// CHECK-D-NEXT: class E { public: @@ -124,131 +27,264 @@ protected: void ProtectedMethod(); }; -// CHECK-E: - // CHECK-E-NEXT: - // CHECK-E-NEXT: blob data = 'E' - // CHECK-E-NEXT: blob data = '{{.*}}' - // CHECK-E-NEXT: -// CHECK-E-NEXT: - -// CHECK-ECON: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: blob data = 'E' - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: blob data = 'E' - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: blob data = '{{.*}}' - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: blob data = 'E' - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: blob data = 'void' - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: - // CHECK-ECON-NEXT: -// CHECK-ECON-NEXT: - -// CHECK-EDES: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: blob data = '~E' - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: blob data = 'E' - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: blob data = '{{.*}}' - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: blob data = 'E' - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: blob data = 'void' - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: - // CHECK-EDES-NEXT: -// CHECK-EDES-NEXT: void E::ProtectedMethod() {} -// CHECK-PM: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: blob data = 'ProtectedMethod' - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: blob data = 'E' - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: blob data = '{{.*}}' - // CHECK-PM-NEXT: blob data = '{{.*}}' - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: blob data = 'E' - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: blob data = 'void' - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: - // CHECK-PM-NEXT: -// CHECK-PM-NEXT: - - class F : virtual private D, public E {}; -// CHECK-F: - // CHECK-F-NEXT: - // CHECK-F-NEXT: blob data = 'F' - // CHECK-F-NEXT: blob data = '{{.*}}' - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: blob data = 'E' - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: blob data = 'D' - // CHECK-F-NEXT: - // CHECK-F-NEXT: - // CHECK-F-NEXT: -// CHECK-F-NEXT: class X { class Y {}; }; -// CHECK-X: - // CHECK-X-NEXT: - // CHECK-X-NEXT: blob data = 'X' - // CHECK-X-NEXT: blob data = '{{.*}}' - // CHECK-X-NEXT: -// CHECK-X-NEXT: - -// CHECK-Y: - // CHECK-Y-NEXT: - // CHECK-Y-NEXT: blob data = 'Y' - // CHECK-Y-NEXT: - // CHECK-Y-NEXT: - // CHECK-Y-NEXT: blob data = 'X' - // CHECK-Y-NEXT: - // CHECK-Y-NEXT: - // CHECK-Y-NEXT: - // CHECK-Y-NEXT: blob data = '{{.*}}' - // CHECK-Y-NEXT: -// CHECK-Y-NEXT: + +// RUN: clang-doc --dump-intermediate --doxygen -p %t %t/test.cpp -output=%t/docs + + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/289584A8E0FF4178A794622A547AA622503967A1.bc | FileCheck %s --check-prefix CHECK-0 +// CHECK-0: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'E' +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'E' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'E' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'E' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'void' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = '~E' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'E' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'E' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'void' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ProtectedMethod' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'E' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'E' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'void' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/CA7C7935730B5EACD25F080E9C83FA087CCDC75E.bc | FileCheck %s --check-prefix CHECK-1 +// CHECK-1: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'X' +// CHECK-1-NEXT: blob data = '{{.*}}' +// CHECK-1-NEXT: +// CHECK-1-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/06B5F6A19BA9F6A832E127C9968282B94619B210.bc | FileCheck %s --check-prefix CHECK-2 +// CHECK-2: +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: blob data = 'C' +// CHECK-2-NEXT: blob data = '{{.*}}' +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: blob data = 'int' +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: blob data = 'i' +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/E60CA1CC7048098A7F4A48C3A53D45A533BDC39B.bc | FileCheck %s --check-prefix CHECK-3 +// CHECK-3: +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: blob data = 'I' +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: blob data = 'H' +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: blob data = '{{.*}}' +// CHECK-3-NEXT: +// CHECK-3-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/641AB4A3D36399954ACDE29C7A8833032BF40472.bc | FileCheck %s --check-prefix CHECK-4 +// CHECK-4: +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: blob data = 'Y' +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: blob data = 'X' +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: blob data = '{{.*}}' +// CHECK-4-NEXT: +// CHECK-4-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/0000000000000000000000000000000000000000.bc | FileCheck %s --check-prefix CHECK-5 +// CHECK-5: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: blob data = 'H' +// CHECK-5-NEXT: blob data = '{{.*}}' +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: blob data = 'void' +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: blob data = 'B' +// CHECK-5-NEXT: blob data = '{{.*}}' +// CHECK-5-NEXT: blob data = 'X' +// CHECK-5-NEXT: blob data = 'Y' +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: blob data = 'Bc' +// CHECK-5-NEXT: blob data = '{{.*}}' +// CHECK-5-NEXT: +// CHECK-5-NEXT: blob data = 'A' +// CHECK-5-NEXT: blob data = 'B' +// CHECK-5-NEXT: +// CHECK-5-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/0921737541208B8FA9BB42B60F78AC1D779AA054.bc | FileCheck %s --check-prefix CHECK-6 +// CHECK-6: +// CHECK-6-NEXT: +// CHECK-6-NEXT: +// CHECK-6-NEXT: +// CHECK-6-NEXT: +// CHECK-6-NEXT: +// CHECK-6-NEXT: blob data = 'D' +// CHECK-6-NEXT: blob data = '{{.*}}' +// CHECK-6-NEXT: +// CHECK-6-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/E3B54702FABFF4037025BA194FC27C47006330B5.bc | FileCheck %s --check-prefix CHECK-7 +// CHECK-7: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: blob data = 'F' +// CHECK-7-NEXT: blob data = '{{.*}}' +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: blob data = 'E' +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: blob data = 'D' +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/ACE81AFA6627B4CEF2B456FB6E1252925674AF7E.bc | FileCheck %s --check-prefix CHECK-8 +// CHECK-8: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: blob data = 'A' +// CHECK-8-NEXT: blob data = '{{.*}}' +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: blob data = 'int' +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: blob data = 'X' +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: blob data = 'int' +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: blob data = 'Y' +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-class-in-class.cpp =================================================================== --- clang-tools-extra/test/clang-doc/mapper-class-in-class.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo "" > %t/compile_flags.txt -// RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/641AB4A3D36399954ACDE29C7A8833032BF40472.bc --dump | FileCheck %s --check-prefix CHECK-X-Y -// RUN: llvm-bcanalyzer %t/docs/bc/CA7C7935730B5EACD25F080E9C83FA087CCDC75E.bc --dump | FileCheck %s --check-prefix CHECK-X - -class X { - class Y {}; -}; - -// CHECK-X: -// CHECK-X-NEXT: - // CHECK-X-NEXT: -// CHECK-X-NEXT: -// CHECK-X-NEXT: - // CHECK-X-NEXT: - // CHECK-X-NEXT: blob data = 'X' - // CHECK-X-NEXT: blob data = '{{.*}}' - // CHECK-X-NEXT: -// CHECK-X-NEXT: - - -// CHECK-X-Y: -// CHECK-X-Y-NEXT: - // CHECK-X-Y-NEXT: -// CHECK-X-Y-NEXT: -// CHECK-X-Y-NEXT: - // CHECK-X-Y-NEXT: - // CHECK-X-Y-NEXT: blob data = 'Y' - // CHECK-X-Y-NEXT: - // CHECK-X-Y-NEXT: - // CHECK-X-Y-NEXT: blob data = 'X' - // CHECK-X-Y-NEXT: - // CHECK-X-Y-NEXT: - // CHECK-X-Y-NEXT: - // CHECK-X-Y-NEXT: blob data = '{{.*}}' - // CHECK-X-Y-NEXT: -// CHECK-X-Y-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-class-in-function.cpp =================================================================== --- clang-tools-extra/test/clang-doc/mapper-class-in-function.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// This test requires Linux due to the system-dependent USR for the -// inner class. -// REQUIRES: system-linux -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo "" > %t/compile_flags.txt -// RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/B6AC4C5C9F2EA3F2B3ECE1A33D349F4EE502B24E.bc --dump | FileCheck %s --check-prefix CHECK-H -// RUN: llvm-bcanalyzer %t/docs/bc/01A95F3F73F53281B3E50109A577FD2493159365.bc --dump | FileCheck %s --check-prefix CHECK-H-I - -void H() { - class I {}; -} - -// CHECK-H: -// CHECK-H-NEXT: - // CHECK-H-NEXT: -// CHECK-H-NEXT: -// CHECK-H-NEXT: - // CHECK-H-NEXT: - // CHECK-H-NEXT: blob data = 'H' - // CHECK-H-NEXT: blob data = '{{.*}}' - // CHECK-H-NEXT: - // CHECK-H-NEXT: - // CHECK-H-NEXT: blob data = 'void' - // CHECK-H-NEXT: - // CHECK-H-NEXT: - // CHECK-H-NEXT: -// CHECK-H-NEXT: - -// CHECK-H-I: -// CHECK-H-I-NEXT: - // CHECK-H-I-NEXT: -// CHECK-H-I-NEXT: -// CHECK-H-I-NEXT: - // CHECK-H-I-NEXT: - // CHECK-H-I-NEXT: blob data = 'I' - // CHECK-H-I-NEXT: - // CHECK-H-I-NEXT: - // CHECK-H-I-NEXT: blob data = 'H' - // CHECK-H-I-NEXT: - // CHECK-H-I-NEXT: - // CHECK-H-I-NEXT: - // CHECK-H-I-NEXT: blob data = '{{.*}}' - // CHECK-H-I-NEXT: -// CHECK-H-I-NEXT: - - Index: clang-tools-extra/test/clang-doc/mapper-class.cpp =================================================================== --- clang-tools-extra/test/clang-doc/mapper-class.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo "" > %t/compile_flags.txt -// RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/289584A8E0FF4178A794622A547AA622503967A1.bc --dump | FileCheck %s - -class E {}; - -// CHECK: -// CHECK-NEXT: - // CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'E' - // CHECK-NEXT: blob data = '{{.*}}' - // CHECK-NEXT: -// CHECK-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-comment.cpp =================================================================== --- /dev/null +++ clang-tools-extra/test/clang-doc/mapper-comment.cpp @@ -0,0 +1,71 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" + +/// \brief Brief description. +/// +/// Extended description that +/// continues onto the next line. +/// +///
    +///
  • Testing. +///
+/// +/// \verbatim +/// The description continues. +/// \endverbatim +/// -- +/// \param [out] I is a parameter. +/// \param J is a parameter. +/// \return void +void F(int I, int J); + +/// Bonus comment on definition +void F(int I, int J) {} + +// RUN: clang-doc --dump-mapper --doxygen -p %t %t/test.cpp -output=%t/docs + + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/0000000000000000000000000000000000000000.bc | FileCheck %s --check-prefix CHECK-0 +// CHECK-0: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'F' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'FullComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ParagraphComment' +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'TextComment' +// CHECK-0-NEXT: blob data = ' Bonus comment on definition' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'void' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'int' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'I' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'int' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'J' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-comments.cpp =================================================================== --- clang-tools-extra/test/clang-doc/mapper-comments.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo "" > %t/compile_flags.txt -// RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/7574630614A535710E5A6ABCFFF98BCA2D06A4CA.bc --dump | FileCheck %s - -/// \brief Brief description. -/// -/// Extended description that -/// continues onto the next line. -/// -///
    class="test"> -///
  • Testing. -///
-/// -/// \verbatim -/// The description continues. -/// \endverbatim -/// -/// \param [out] I is a parameter. -/// \param J is a parameter. -/// \return int -int F(int I, int J); - -// CHECK: -// CHECK-NEXT: - // CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'F' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'FullComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'BlockCommandComment' - // CHECK-NEXT: blob data = 'brief' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' Brief description.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' Extended description that' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' continues onto the next line.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'HTMLStartTagComment' - // CHECK-NEXT: blob data = 'ul' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' class="test">' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'HTMLStartTagComment' - // CHECK-NEXT: blob data = 'li' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' Testing.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'HTMLEndTagComment' - // CHECK-NEXT: blob data = 'ul' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'VerbatimBlockComment' - // CHECK-NEXT: blob data = 'verbatim' - // CHECK-NEXT: blob data = 'endverbatim' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'VerbatimBlockLineComment' - // CHECK-NEXT: blob data = ' The description continues.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParamCommandComment' - // CHECK-NEXT: blob data = '[out]' - // CHECK-NEXT: blob data = 'I' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' is a parameter.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParamCommandComment' - // CHECK-NEXT: blob data = '[in]' - // CHECK-NEXT: blob data = 'J' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' is a parameter.' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'BlockCommandComment' - // CHECK-NEXT: blob data = 'return' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'ParagraphComment' - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'TextComment' - // CHECK-NEXT: blob data = ' int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = '{{.*}}' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'I' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'J' - // CHECK-NEXT: -// CHECK-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-enum.cpp =================================================================== --- clang-tools-extra/test/clang-doc/mapper-enum.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo "" > %t/compile_flags.txt -// RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/FC07BD34D5E77782C263FA944447929EA8753740.bc --dump | FileCheck %s --check-prefix CHECK-B -// RUN: llvm-bcanalyzer %t/docs/bc/020E6C32A700C3170C009FCCD41671EDDBEAF575.bc --dump | FileCheck %s --check-prefix CHECK-C - -enum B { X, Y }; - -// CHECK-B: -// CHECK-B-NEXT: - // CHECK-B-NEXT: -// CHECK-B-NEXT: -// CHECK-B-NEXT: - // CHECK-B-NEXT: - // CHECK-B-NEXT: blob data = 'B' - // CHECK-B-NEXT: blob data = '{{.*}}' - // CHECK-B-NEXT: blob data = 'X' - // CHECK-B-NEXT: blob data = 'Y' -// CHECK-B-NEXT: - -enum class C { A, B }; - -// CHECK-C: -// CHECK-C-NEXT: - // CHECK-C-NEXT: -// CHECK-C-NEXT: -// CHECK-C-NEXT: - // CHECK-C-NEXT: - // CHECK-C-NEXT: blob data = 'C' - // CHECK-C-NEXT: blob data = '{{.*}}' - // CHECK-C-NEXT: - // CHECK-C-NEXT: blob data = 'A' - // CHECK-C-NEXT: blob data = 'B' -// CHECK-C-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-function.cpp =================================================================== --- clang-tools-extra/test/clang-doc/mapper-function.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo "" > %t/compile_flags.txt -// RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/A44B32CC3C087C9AF75DAF50DE193E85E7B2C16B.bc --dump | FileCheck %s - -int F(int param) { return param; } - -// CHECK: -// CHECK-NEXT: - // CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'F' - // CHECK-NEXT: blob data = '{{.*}}' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'param' - // CHECK-NEXT: -// CHECK-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-method.cpp =================================================================== --- clang-tools-extra/test/clang-doc/mapper-method.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo "" > %t/compile_flags.txt -// RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/F0F9FC65FC90F54F690144A7AFB15DFC3D69B6E6.bc --dump | FileCheck %s --check-prefix CHECK-G-F -// RUN: llvm-bcanalyzer %t/docs/bc/4202E8BF0ECB12AE354C8499C52725B0EE30AED5.bc --dump | FileCheck %s --check-prefix CHECK-G - -class G { -public: - int Method(int param) { return param; } -}; - -// CHECK-G: -// CHECK-G-NEXT: - // CHECK-G-NEXT: -// CHECK-G-NEXT: -// CHECK-G-NEXT: - // CHECK-G-NEXT: - // CHECK-G-NEXT: blob data = 'G' - // CHECK-G-NEXT: blob data = '{{.*}}' - // CHECK-G-NEXT: -// CHECK-G-NEXT: - -// CHECK-G-F: -// CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: -// CHECK-G-F-NEXT: -// CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: blob data = 'Method' - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: blob data = 'G' - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: blob data = '{{.*}}' - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: blob data = 'G' - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: blob data = 'int' - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: blob data = 'int' - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: - // CHECK-G-F-NEXT: blob data = 'param' - // CHECK-G-F-NEXT: -// CHECK-G-F-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-namespace.cpp =================================================================== --- clang-tools-extra/test/clang-doc/mapper-namespace.cpp +++ clang-tools-extra/test/clang-doc/mapper-namespace.cpp @@ -2,16 +2,90 @@ // RUN: mkdir %t // RUN: echo "" > %t/compile_flags.txt // RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/8D042EFFC98B373450BC6B5B90A330C25A150E9C.bc --dump | FileCheck %s - -namespace A {} - -// CHECK: -// CHECK-NEXT: - // CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'A' -// CHECK-NEXT: + +namespace A { + +void f(); + +} // namespace A + +namespace A { + +void f(){}; + +namespace B { + +enum E { X }; + +E func(int i) { return X; } + +} // namespace B +} // namespace A + +// RUN: clang-doc --dump-mapper --doxygen -p %t %t/test.cpp -output=%t/docs + + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/8D042EFFC98B373450BC6B5B90A330C25A150E9C.bc | FileCheck %s --check-prefix CHECK-0 +// CHECK-0: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'f' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'A' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'void' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/E21AF79E2A9D02554BA090D10DF39FE273F5CDB5.bc | FileCheck %s --check-prefix CHECK-1 +// CHECK-1: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'func' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'B' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'A' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = '{{.*}}' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'enum A::B::E' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'int' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'i' +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-record.cpp =================================================================== --- /dev/null +++ clang-tools-extra/test/clang-doc/mapper-record.cpp @@ -0,0 +1,217 @@ +// This test requires Linux due to system-dependent USR for the inner class. +// REQUIRES: system-linux +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" + +void H() { + class I {}; +} + +union A { int X; int Y; }; + +enum B { X, Y }; + +enum class Bc { A, B }; + +struct C { int i; }; + +class D {}; + +class E { +public: + E() {} + ~E() {} + +protected: + void ProtectedMethod(); +}; + +void E::ProtectedMethod() {} + +class F : virtual private D, public E {}; + +class X { + class Y {}; +}; + +// RUN: clang-doc --dump-mapper --doxygen -p %t %t/test.cpp -output=%t/docs + + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/289584A8E0FF4178A794622A547AA622503967A1.bc | FileCheck %s --check-prefix CHECK-0 +// CHECK-0: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'ProtectedMethod' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'E' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = '{{.*}}' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'E' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: blob data = 'void' +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: +// CHECK-0-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/CA7C7935730B5EACD25F080E9C83FA087CCDC75E.bc | FileCheck %s --check-prefix CHECK-1 +// CHECK-1: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: +// CHECK-1-NEXT: blob data = 'X' +// CHECK-1-NEXT: blob data = '{{.*}}' +// CHECK-1-NEXT: +// CHECK-1-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/06B5F6A19BA9F6A832E127C9968282B94619B210.bc | FileCheck %s --check-prefix CHECK-2 +// CHECK-2: +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: blob data = 'C' +// CHECK-2-NEXT: blob data = '{{.*}}' +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: blob data = 'int' +// CHECK-2-NEXT: +// CHECK-2-NEXT: +// CHECK-2-NEXT: blob data = 'i' +// CHECK-2-NEXT: +// CHECK-2-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/E60CA1CC7048098A7F4A48C3A53D45A533BDC39B.bc | FileCheck %s --check-prefix CHECK-3 +// CHECK-3: +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: blob data = 'I' +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: blob data = 'H' +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: +// CHECK-3-NEXT: blob data = '{{.*}}' +// CHECK-3-NEXT: +// CHECK-3-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/641AB4A3D36399954ACDE29C7A8833032BF40472.bc | FileCheck %s --check-prefix CHECK-4 +// CHECK-4: +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: blob data = 'Y' +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: blob data = 'X' +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: +// CHECK-4-NEXT: blob data = '{{.*}}' +// CHECK-4-NEXT: +// CHECK-4-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/0000000000000000000000000000000000000000.bc | FileCheck %s --check-prefix CHECK-5 +// CHECK-5: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: +// CHECK-5-NEXT: blob data = 'Bc' +// CHECK-5-NEXT: blob data = '{{.*}}' +// CHECK-5-NEXT: +// CHECK-5-NEXT: blob data = 'A' +// CHECK-5-NEXT: blob data = 'B' +// CHECK-5-NEXT: +// CHECK-5-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/0921737541208B8FA9BB42B60F78AC1D779AA054.bc | FileCheck %s --check-prefix CHECK-6 +// CHECK-6: +// CHECK-6-NEXT: +// CHECK-6-NEXT: +// CHECK-6-NEXT: +// CHECK-6-NEXT: +// CHECK-6-NEXT: +// CHECK-6-NEXT: blob data = 'D' +// CHECK-6-NEXT: blob data = '{{.*}}' +// CHECK-6-NEXT: +// CHECK-6-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/E3B54702FABFF4037025BA194FC27C47006330B5.bc | FileCheck %s --check-prefix CHECK-7 +// CHECK-7: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: blob data = 'F' +// CHECK-7-NEXT: blob data = '{{.*}}' +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: blob data = 'E' +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: blob data = 'D' +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: +// CHECK-7-NEXT: + +// RUN: llvm-bcanalyzer --dump %t/docs/bc/ACE81AFA6627B4CEF2B456FB6E1252925674AF7E.bc | FileCheck %s --check-prefix CHECK-8 +// CHECK-8: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: blob data = 'A' +// CHECK-8-NEXT: blob data = '{{.*}}' +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: blob data = 'int' +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: blob data = 'X' +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: blob data = 'int' +// CHECK-8-NEXT: +// CHECK-8-NEXT: +// CHECK-8-NEXT: blob data = 'Y' +// CHECK-8-NEXT: +// CHECK-8-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-struct.cpp =================================================================== --- clang-tools-extra/test/clang-doc/mapper-struct.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo "" > %t/compile_flags.txt -// RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/06B5F6A19BA9F6A832E127C9968282B94619B210.bc --dump | FileCheck %s - -struct C { int i; }; - -// CHECK: -// CHECK-NEXT: - // CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'C' - // CHECK-NEXT: blob data = '{{.*}}' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'i' - // CHECK-NEXT: -// CHECK-NEXT: Index: clang-tools-extra/test/clang-doc/mapper-union.cpp =================================================================== --- clang-tools-extra/test/clang-doc/mapper-union.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo "" > %t/compile_flags.txt -// RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: llvm-bcanalyzer %t/docs/bc/0B8A6B938B939B77C6325CCCC8AA3E938BF9E2E8.bc --dump | FileCheck %s - -union D { int X; int Y; }; - -// CHECK: -// CHECK-NEXT: - // CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'D' - // CHECK-NEXT: blob data = '{{.*}}' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'X' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'int' - // CHECK-NEXT: - // CHECK-NEXT: - // CHECK-NEXT: blob data = 'Y' - // CHECK-NEXT: -// CHECK-NEXT: Index: clang-tools-extra/test/clang-doc/yaml-comment.cpp =================================================================== --- /dev/null +++ clang-tools-extra/test/clang-doc/yaml-comment.cpp @@ -0,0 +1,135 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" + +/// \brief Brief description. +/// +/// Extended description that +/// continues onto the next line. +/// +///
    +///
  • Testing. +///
+/// +/// \verbatim +/// The description continues. +/// \endverbatim +/// -- +/// \param [out] I is a parameter. +/// \param J is a parameter. +/// \return void +void F(int I, int J); + +/// Bonus comment on definition +void F(int I, int J) {} + +// RUN: clang-doc --format=yaml --doxygen -p %t %t/test.cpp -output=%t/docs + + +// RUN: cat %t/docs/./GlobalNamespace.yaml | FileCheck %s --check-prefix CHECK-0 +// CHECK-0: --- +// CHECK-0-NEXT: USR: '0000000000000000000000000000000000000000' +// CHECK-0-NEXT: ChildFunctions: +// CHECK-0-NEXT: - USR: '7574630614A535710E5A6ABCFFF98BCA2D06A4CA' +// CHECK-0-NEXT: Name: 'F' +// CHECK-0-NEXT: Description: +// CHECK-0-NEXT: - Kind: 'FullComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'ParagraphComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: - Kind: 'BlockCommandComment' +// CHECK-0-NEXT: Name: 'brief' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'ParagraphComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: Text: ' Brief description.' +// CHECK-0-NEXT: - Kind: 'ParagraphComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: Text: ' Extended description that' +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: Text: ' continues onto the next line.' +// CHECK-0-NEXT: - Kind: 'ParagraphComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: - Kind: 'HTMLStartTagComment' +// CHECK-0-NEXT: Name: 'ul' +// CHECK-0-NEXT: AttrKeys: +// CHECK-0-NEXT: - 'class' +// CHECK-0-NEXT: AttrValues: +// CHECK-0-NEXT: - 'test' +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: - Kind: 'HTMLStartTagComment' +// CHECK-0-NEXT: Name: 'li' +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: Text: ' Testing.' +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: - Kind: 'HTMLEndTagComment' +// CHECK-0-NEXT: Name: 'ul' +// CHECK-0-NEXT: SelfClosing: true +// CHECK-0-NEXT: - Kind: 'ParagraphComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: - Kind: 'VerbatimBlockComment' +// CHECK-0-NEXT: Name: 'verbatim' +// CHECK-0-NEXT: CloseName: 'endverbatim' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'VerbatimBlockLineComment' +// CHECK-0-NEXT: Text: ' The description continues.' +// CHECK-0-NEXT: - Kind: 'ParagraphComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: Text: ' --' +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: - Kind: 'ParamCommandComment' +// CHECK-0-NEXT: Direction: '[out]' +// CHECK-0-NEXT: ParamName: 'I' +// CHECK-0-NEXT: Explicit: true +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'ParagraphComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: Text: ' is a parameter.' +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: - Kind: 'ParamCommandComment' +// CHECK-0-NEXT: Direction: '[in]' +// CHECK-0-NEXT: ParamName: 'J' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'ParagraphComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: Text: ' is a parameter.' +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: - Kind: 'BlockCommandComment' +// CHECK-0-NEXT: Name: 'return' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'ParagraphComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: Text: ' void' +// CHECK-0-NEXT: - Kind: 'FullComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'ParagraphComment' +// CHECK-0-NEXT: Children: +// CHECK-0-NEXT: - Kind: 'TextComment' +// CHECK-0-NEXT: Text: ' Bonus comment on definition' +// CHECK-0-NEXT: DefLocation: +// CHECK-0-NEXT: LineNumber: 25 +// CHECK-0-NEXT: Filename: 'test' +// CHECK-0-NEXT: Location: +// CHECK-0-NEXT: - LineNumber: 22 +// CHECK-0-NEXT: Filename: 'test' +// CHECK-0-NEXT: Params: +// CHECK-0-NEXT: - Type: +// CHECK-0-NEXT: Name: 'int' +// CHECK-0-NEXT: Name: 'I' +// CHECK-0-NEXT: - Type: +// CHECK-0-NEXT: Name: 'int' +// CHECK-0-NEXT: Name: 'J' +// CHECK-0-NEXT: ReturnType: +// CHECK-0-NEXT: Type: +// CHECK-0-NEXT: Name: 'void' +// CHECK-0-NEXT: ... Index: clang-tools-extra/test/clang-doc/yaml-comments.cpp =================================================================== --- clang-tools-extra/test/clang-doc/yaml-comments.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir %t -// RUN: echo "" > %t/compile_flags.txt -// RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: cat %t/docs/F.yaml | FileCheck %s - -/// \brief Brief description. -/// -/// Extended description that -/// continues onto the next line. -/// -///
    -///
  • Testing. -///
-/// -/// \verbatim -/// The description continues. -/// \endverbatim -/// -/// \param [out] I is a parameter. -/// \param J is a parameter. -/// \return void -void F(int I, int J); - -/// Bonus comment on definition -void F(int I, int J) {} - -// CHECK: --- -// CHECK-NEXT: USR: '7574630614A535710E5A6ABCFFF98BCA2D06A4CA' -// CHECK-NEXT: Name: 'F' -// CHECK-NEXT: Description: -// CHECK-NEXT: - Kind: 'FullComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'ParagraphComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: - Kind: 'BlockCommandComment' -// CHECK-NEXT: Name: 'brief' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'ParagraphComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: Text: ' Brief description.' -// CHECK-NEXT: - Kind: 'ParagraphComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: Text: ' Extended description that' -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: Text: ' continues onto the next line.' -// CHECK-NEXT: - Kind: 'ParagraphComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: - Kind: 'HTMLStartTagComment' -// CHECK-NEXT: Name: 'ul' -// CHECK-NEXT: AttrKeys: -// CHECK-NEXT: - 'class' -// CHECK-NEXT: AttrValues: -// CHECK-NEXT: - 'test' -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: - Kind: 'HTMLStartTagComment' -// CHECK-NEXT: Name: 'li' -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: Text: ' Testing.' -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: - Kind: 'HTMLEndTagComment' -// CHECK-NEXT: Name: 'ul' -// CHECK-NEXT: SelfClosing: true -// CHECK-NEXT: - Kind: 'ParagraphComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: - Kind: 'VerbatimBlockComment' -// CHECK-NEXT: Name: 'verbatim' -// CHECK-NEXT: CloseName: 'endverbatim' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'VerbatimBlockLineComment' -// CHECK-NEXT: Text: ' The description continues.' -// CHECK-NEXT: - Kind: 'ParagraphComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: - Kind: 'ParamCommandComment' -// CHECK-NEXT: Direction: '[out]' -// CHECK-NEXT: ParamName: 'I' -// CHECK-NEXT: Explicit: true -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'ParagraphComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: Text: ' is a parameter.' -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: - Kind: 'ParamCommandComment' -// CHECK-NEXT: Direction: '[in]' -// CHECK-NEXT: ParamName: 'J' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'ParagraphComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: Text: ' is a parameter.' -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: - Kind: 'BlockCommandComment' -// CHECK-NEXT: Name: 'return' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'ParagraphComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: Text: ' void' -// CHECK-NEXT: - Kind: 'FullComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'ParagraphComment' -// CHECK-NEXT: Children: -// CHECK-NEXT: - Kind: 'TextComment' -// CHECK-NEXT: Text: ' Bonus comment on definition' -// CHECK-NEXT: DefLocation: -// CHECK-NEXT: LineNumber: 27 -// CHECK-NEXT: Filename: '{{.*}}' -// CHECK-NEXT: Location: -// CHECK-NEXT: - LineNumber: 24 -// CHECK-NEXT: Filename: '{{.*}}' -// CHECK-NEXT: Params: -// CHECK-NEXT: - Type: -// CHECK-NEXT: Name: 'int' -// CHECK-NEXT: Name: 'I' -// CHECK-NEXT: - Type: -// CHECK-NEXT: Name: 'int' -// CHECK-NEXT: Name: 'J' -// CHECK-NEXT: ReturnType: -// CHECK-NEXT: Type: -// CHECK-NEXT: Name: 'void' -// CHECK-NEXT: ... Index: clang-tools-extra/test/clang-doc/yaml-namespace.cpp =================================================================== --- clang-tools-extra/test/clang-doc/yaml-namespace.cpp +++ clang-tools-extra/test/clang-doc/yaml-namespace.cpp @@ -2,21 +2,9 @@ // RUN: mkdir %t // RUN: echo "" > %t/compile_flags.txt // RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: cat %t/docs/A.yaml | FileCheck %s --check-prefix=CHECK-A -// RUN: cat %t/docs/A/B.yaml | FileCheck %s --check-prefix=CHECK-B -// RUN: cat %t/docs/A/f.yaml | FileCheck %s --check-prefix=CHECK-F -// RUN: cat %t/docs/A/B/E.yaml | FileCheck %s --check-prefix=CHECK-E -// RUN: cat %t/docs/A/B/func.yaml | FileCheck %s --check-prefix=CHECK-FUNC namespace A { -// CHECK-A: --- -// CHECK-A-NEXT: USR: '8D042EFFC98B373450BC6B5B90A330C25A150E9C' -// CHECK-A-NEXT: Name: 'A' -// CHECK-A-NEXT: ... - - void f(); } // namespace A @@ -25,78 +13,81 @@ void f(){}; -// CHECK-F: --- -// CHECK-F-NEXT: USR: '39D3C95A5F7CE2BA4937BD7B01BAE09EBC2AD8AC' -// CHECK-F-NEXT: Name: 'f' -// CHECK-F-NEXT: Namespace: -// CHECK-F-NEXT: - Type: Namespace -// CHECK-F-NEXT: Name: 'A' -// CHECK-F-NEXT: USR: '8D042EFFC98B373450BC6B5B90A330C25A150E9C' -// CHECK-F-NEXT: DefLocation: -// CHECK-F-NEXT: LineNumber: 26 -// CHECK-F-NEXT: Filename: '{{.*}}' -// CHECK-F-NEXT: Location: -// CHECK-F-NEXT: - LineNumber: 20 -// CHECK-F-NEXT: Filename: 'test' -// CHECK-F-NEXT: ReturnType: -// CHECK-F-NEXT: Type: -// CHECK-F-NEXT: Name: 'void' -// CHECK-F-NEXT: ... - namespace B { - -// CHECK-B: --- -// CHECK-B-NEXT: USR: 'E21AF79E2A9D02554BA090D10DF39FE273F5CDB5' -// CHECK-B-NEXT: Name: 'B' -// CHECK-B-NEXT: Namespace: -// CHECK-B-NEXT: - Type: Namespace -// CHECK-B-NEXT: Name: 'A' -// CHECK-B-NEXT: USR: '8D042EFFC98B373450BC6B5B90A330C25A150E9C' -// CHECK-B-NEXT: ... - enum E { X }; -// CHECK-E: --- -// CHECK-E-NEXT: USR: 'E9ABF7E7E2425B626723D41E76E4BC7E7A5BD775' -// CHECK-E-NEXT: Name: 'E' -// CHECK-E-NEXT: Namespace: -// CHECK-E-NEXT: - Type: Namespace -// CHECK-E-NEXT: Name: 'B' -// CHECK-E-NEXT: USR: 'E21AF79E2A9D02554BA090D10DF39FE273F5CDB5' -// CHECK-E-NEXT: - Type: Namespace -// CHECK-E-NEXT: Name: 'A' -// CHECK-E-NEXT: USR: '8D042EFFC98B373450BC6B5B90A330C25A150E9C' -// CHECK-E-NEXT: DefLocation: -// CHECK-E-NEXT: LineNumber: 58 -// CHECK-E-NEXT: Filename: '{{.*}}' -// CHECK-E-NEXT: Members: -// CHECK-E-NEXT: - 'X' -// CHECK-E-NEXT: ... - E func(int i) { return X; } -// CHECK-FUNC: --- -// CHECK-FUNC-NEXT: USR: '9A82CB33ED0FDF81EE383D31CD0957D153C5E840' -// CHECK-FUNC-NEXT: Name: 'func' -// CHECK-FUNC-NEXT: Namespace: -// CHECK-FUNC-NEXT: - Type: Namespace -// CHECK-FUNC-NEXT: Name: 'B' -// CHECK-FUNC-NEXT: USR: 'E21AF79E2A9D02554BA090D10DF39FE273F5CDB5' -// CHECK-FUNC-NEXT: - Type: Namespace -// CHECK-FUNC-NEXT: Name: 'A' -// CHECK-FUNC-NEXT: USR: '8D042EFFC98B373450BC6B5B90A330C25A150E9C' -// CHECK-FUNC-NEXT: DefLocation: -// CHECK-FUNC-NEXT: LineNumber: 77 -// CHECK-FUNC-NEXT: Filename: '{{.*}}' -// CHECK-FUNC-NEXT: Params: -// CHECK-FUNC-NEXT: - Type: -// CHECK-FUNC-NEXT: Name: 'int' -// CHECK-FUNC-NEXT: Name: 'i' -// CHECK-FUNC-NEXT: ReturnType: -// CHECK-FUNC-NEXT: Type: -// CHECK-FUNC-NEXT: Name: 'enum A::B::E' -// CHECK-FUNC-NEXT: ... - } // namespace B } // namespace A + +// RUN: clang-doc --format=yaml --doxygen -p %t %t/test.cpp -output=%t/docs + + +// RUN: cat %t/docs/./A.yaml | FileCheck %s --check-prefix CHECK-0 +// CHECK-0: --- +// CHECK-0-NEXT: USR: '8D042EFFC98B373450BC6B5B90A330C25A150E9C' +// CHECK-0-NEXT: Name: 'A' +// CHECK-0-NEXT: ChildFunctions: +// CHECK-0-NEXT: - USR: '39D3C95A5F7CE2BA4937BD7B01BAE09EBC2AD8AC' +// CHECK-0-NEXT: Name: 'f' +// CHECK-0-NEXT: Namespace: +// CHECK-0-NEXT: - Type: Namespace +// CHECK-0-NEXT: Name: 'A' +// CHECK-0-NEXT: USR: '8D042EFFC98B373450BC6B5B90A330C25A150E9C' +// CHECK-0-NEXT: DefLocation: +// CHECK-0-NEXT: LineNumber: 14 +// CHECK-0-NEXT: Filename: 'test' +// CHECK-0-NEXT: Location: +// CHECK-0-NEXT: - LineNumber: 8 +// CHECK-0-NEXT: Filename: 'test' +// CHECK-0-NEXT: ReturnType: +// CHECK-0-NEXT: Type: +// CHECK-0-NEXT: Name: 'void' +// CHECK-0-NEXT: ... + +// RUN: cat %t/docs/A/B.yaml | FileCheck %s --check-prefix CHECK-1 +// CHECK-1: --- +// CHECK-1-NEXT: USR: 'E21AF79E2A9D02554BA090D10DF39FE273F5CDB5' +// CHECK-1-NEXT: Name: 'B' +// CHECK-1-NEXT: Namespace: +// CHECK-1-NEXT: - Type: Namespace +// CHECK-1-NEXT: Name: 'A' +// CHECK-1-NEXT: USR: '8D042EFFC98B373450BC6B5B90A330C25A150E9C' +// CHECK-1-NEXT: ChildFunctions: +// CHECK-1-NEXT: - USR: '9A82CB33ED0FDF81EE383D31CD0957D153C5E840' +// CHECK-1-NEXT: Name: 'func' +// CHECK-1-NEXT: Namespace: +// CHECK-1-NEXT: - Type: Namespace +// CHECK-1-NEXT: Name: 'B' +// CHECK-1-NEXT: USR: 'E21AF79E2A9D02554BA090D10DF39FE273F5CDB5' +// CHECK-1-NEXT: - Type: Namespace +// CHECK-1-NEXT: Name: 'A' +// CHECK-1-NEXT: USR: '8D042EFFC98B373450BC6B5B90A330C25A150E9C' +// CHECK-1-NEXT: DefLocation: +// CHECK-1-NEXT: LineNumber: 20 +// CHECK-1-NEXT: Filename: 'test' +// CHECK-1-NEXT: Params: +// CHECK-1-NEXT: - Type: +// CHECK-1-NEXT: Name: 'int' +// CHECK-1-NEXT: Name: 'i' +// CHECK-1-NEXT: ReturnType: +// CHECK-1-NEXT: Type: +// CHECK-1-NEXT: Name: 'enum A::B::E' +// CHECK-1-NEXT: ChildEnums: +// CHECK-1-NEXT: - USR: 'E9ABF7E7E2425B626723D41E76E4BC7E7A5BD775' +// CHECK-1-NEXT: Name: 'E' +// CHECK-1-NEXT: Namespace: +// CHECK-1-NEXT: - Type: Namespace +// CHECK-1-NEXT: Name: 'B' +// CHECK-1-NEXT: USR: 'E21AF79E2A9D02554BA090D10DF39FE273F5CDB5' +// CHECK-1-NEXT: - Type: Namespace +// CHECK-1-NEXT: Name: 'A' +// CHECK-1-NEXT: USR: '8D042EFFC98B373450BC6B5B90A330C25A150E9C' +// CHECK-1-NEXT: DefLocation: +// CHECK-1-NEXT: LineNumber: 18 +// CHECK-1-NEXT: Filename: 'test' +// CHECK-1-NEXT: Members: +// CHECK-1-NEXT: - 'X' +// CHECK-1-NEXT: ... Index: clang-tools-extra/test/clang-doc/yaml-record.cpp =================================================================== --- clang-tools-extra/test/clang-doc/yaml-record.cpp +++ clang-tools-extra/test/clang-doc/yaml-record.cpp @@ -1,250 +1,233 @@ +// This test requires Linux due to system-dependent USR for the inner class. +// REQUIRES: system-linux // RUN: rm -rf %t // RUN: mkdir %t // RUN: echo "" > %t/compile_flags.txt // RUN: cp "%s" "%t/test.cpp" -// RUN: clang-doc -doxygen -p %t %t/test.cpp -output=%t/docs -// RUN: cat %t/docs/A.yaml | FileCheck %s --check-prefix=CHECK-A -// RUN: cat %t/docs/Bc.yaml | FileCheck %s --check-prefix=CHECK-BC -// RUN: cat %t/docs/B.yaml | FileCheck %s --check-prefix=CHECK-B -// RUN: cat %t/docs/C.yaml | FileCheck %s --check-prefix=CHECK-C -// RUN: cat %t/docs/D.yaml | FileCheck %s --check-prefix=CHECK-D -// RUN: cat %t/docs/E.yaml | FileCheck %s --check-prefix=CHECK-E -// RUN: cat %t/docs/E/ProtectedMethod.yaml | FileCheck %s --check-prefix=CHECK-EPM -// RUN: cat %t/docs/E/E.yaml | FileCheck %s --check-prefix=CHECK-ECON -// RUN: cat %t/docs/E/'~E.yaml' | FileCheck %s --check-prefix=CHECK-EDES -// RUN: cat %t/docs/F.yaml | FileCheck %s --check-prefix=CHECK-F -// RUN: cat %t/docs/X.yaml | FileCheck %s --check-prefix=CHECK-X -// RUN: cat %t/docs/X/Y.yaml | FileCheck %s --check-prefix=CHECK-Y -// RUN: cat %t/docs/H.yaml | FileCheck %s --check-prefix=CHECK-H -// RUN: cat %t/docs/H/I.yaml | FileCheck %s --check-prefix=CHECK-I -union A { int X; int Y; }; - -// CHECK-A: --- -// CHECK-A-NEXT: USR: 'ACE81AFA6627B4CEF2B456FB6E1252925674AF7E' -// CHECK-A-NEXT: Name: 'A' -// CHECK-A-NEXT: DefLocation: -// CHECK-A-NEXT: LineNumber: 21 -// CHECK-A-NEXT: Filename: '{{.*}}' -// CHECK-A-NEXT: TagType: Union -// CHECK-A-NEXT: Members: -// CHECK-A-NEXT: - Type: -// CHECK-A-NEXT: Name: 'int' -// CHECK-A-NEXT: Name: 'X' -// CHECK-A-NEXT: - Type: -// CHECK-A-NEXT: Name: 'int' -// CHECK-A-NEXT: Name: 'Y' -// CHECK-A-NEXT: ... +void H() { + class I {}; +} +union A { int X; int Y; }; enum B { X, Y }; -// CHECK-B: --- -// CHECK-B-NEXT: USR: 'FC07BD34D5E77782C263FA944447929EA8753740' -// CHECK-B-NEXT: Name: 'B' -// CHECK-B-NEXT: DefLocation: -// CHECK-B-NEXT: LineNumber: 40 -// CHECK-B-NEXT: Filename: '{{.*}}' -// CHECK-B-NEXT: Members: -// CHECK-B-NEXT: - 'X' -// CHECK-B-NEXT: - 'Y' -// CHECK-B-NEXT: ... - enum class Bc { A, B }; -// CHECK-BC: --- -// CHECK-BC-NEXT: USR: '1E3438A08BA22025C0B46289FF0686F92C8924C5' -// CHECK-BC-NEXT: Name: 'Bc' -// CHECK-BC-NEXT: DefLocation: -// CHECK-BC-NEXT: LineNumber: 53 -// CHECK-BC-NEXT: Filename: '{{.*}}' -// CHECK-BC-NEXT: Scoped: true -// CHECK-BC-NEXT: Members: -// CHECK-BC-NEXT: - 'A' -// CHECK-BC-NEXT: - 'B' -// CHECK-BC-NEXT: ... - struct C { int i; }; -// CHECK-C: --- -// CHECK-C-NEXT: USR: '06B5F6A19BA9F6A832E127C9968282B94619B210' -// CHECK-C-NEXT: Name: 'C' -// CHECK-C-NEXT: DefLocation: -// CHECK-C-NEXT: LineNumber: 67 -// CHECK-C-NEXT: Filename: '{{.*}}' -// CHECK-C-NEXT: Members: -// CHECK-C-NEXT: - Type: -// CHECK-C-NEXT: Name: 'int' -// CHECK-C-NEXT: Name: 'i' -// CHECK-C-NEXT: ... - class D {}; -// CHECK-D: --- -// CHECK-D-NEXT: USR: '0921737541208B8FA9BB42B60F78AC1D779AA054' -// CHECK-D-NEXT: Name: 'D' -// CHECK-D-NEXT: DefLocation: -// CHECK-D-NEXT: LineNumber: 81 -// CHECK-D-NEXT: Filename: '{{.*}}' -// CHECK-D-NEXT: TagType: Class -// CHECK-D-NEXT: ... - class E { public: E() {} - -// CHECK-ECON: --- -// CHECK-ECON-NEXT: USR: 'DEB4AC1CD9253CD9EF7FBE6BCAC506D77984ABD4' -// CHECK-ECON-NEXT: Name: 'E' -// CHECK-ECON-NEXT: Namespace: -// CHECK-ECON-NEXT: - Type: Record -// CHECK-ECON-NEXT: Name: 'E' -// CHECK-ECON-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' -// CHECK-ECON-NEXT: DefLocation: -// CHECK-ECON-NEXT: LineNumber: 94 -// CHECK-ECON-NEXT: Filename: '{{.*}}' -// CHECK-ECON-NEXT: IsMethod: true -// CHECK-ECON-NEXT: Parent: -// CHECK-ECON-NEXT: Type: Record -// CHECK-ECON-NEXT: Name: 'E' -// CHECK-ECON-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' -// CHECK-ECON-NEXT: ReturnType: -// CHECK-ECON-NEXT: Type: -// CHECK-ECON-NEXT: Name: 'void' -// CHECK-ECON-NEXT: ... - ~E() {} - -// CHECK-EDES: --- -// CHECK-EDES-NEXT: USR: 'BD2BDEBD423F80BACCEA75DE6D6622D355FC2D17' -// CHECK-EDES-NEXT: Name: '~E' -// CHECK-EDES-NEXT: Namespace: -// CHECK-EDES-NEXT: - Type: Record -// CHECK-EDES-NEXT: Name: 'E' -// CHECK-EDES-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' -// CHECK-EDES-NEXT: DefLocation: -// CHECK-EDES-NEXT: LineNumber: 116 -// CHECK-EDES-NEXT: Filename: '{{.*}}' -// CHECK-EDES-NEXT: IsMethod: true -// CHECK-EDES-NEXT: Parent: -// CHECK-EDES-NEXT: Type: Record -// CHECK-EDES-NEXT: Name: 'E' -// CHECK-EDES-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' -// CHECK-EDES-NEXT: ReturnType: -// CHECK-EDES-NEXT: Type: -// CHECK-EDES-NEXT: Name: 'void' -// CHECK-EDES-NEXT: ... - protected: void ProtectedMethod(); }; -// CHECK-E: --- -// CHECK-E-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' -// CHECK-E-NEXT: Name: 'E' -// CHECK-E-NEXT: DefLocation: -// CHECK-E-NEXT: LineNumber: 92 -// CHECK-E-NEXT: Filename: '{{.*}}' -// CHECK-E-NEXT: TagType: Class -// CHECK-E-NEXT: ... - void E::ProtectedMethod() {} -// CHECK-EPM: --- -// CHECK-EPM-NEXT: USR: '5093D428CDC62096A67547BA52566E4FB9404EEE' -// CHECK-EPM-NEXT: Name: 'ProtectedMethod' -// CHECK-EPM-NEXT: Namespace: -// CHECK-EPM-NEXT: - Type: Record -// CHECK-EPM-NEXT: Name: 'E' -// CHECK-EPM-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' -// CHECK-EPM-NEXT: DefLocation: -// CHECK-EPM-NEXT: LineNumber: 152 -// CHECK-EPM-NEXT: Filename: '{{.*}}' -// CHECK-EPM-NEXT: Location: -// CHECK-EPM-NEXT: - LineNumber: 140 -// CHECK-EPM-NEXT: Filename: '{{.*}}' -// CHECK-EPM-NEXT: IsMethod: true -// CHECK-EPM-NEXT: Parent: -// CHECK-EPM-NEXT: Type: Record -// CHECK-EPM-NEXT: Name: 'E' -// CHECK-EPM-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' -// CHECK-EPM-NEXT: ReturnType: -// CHECK-EPM-NEXT: Type: -// CHECK-EPM-NEXT: Name: 'void' -// CHECK-EPM-NEXT: ... - class F : virtual private D, public E {}; -// CHECK-F: --- -// CHECK-F-NEXT: USR: 'E3B54702FABFF4037025BA194FC27C47006330B5' -// CHECK-F-NEXT: Name: 'F' -// CHECK-F-NEXT: DefLocation: -// CHECK-F-NEXT: LineNumber: 177 -// CHECK-F-NEXT: Filename: '{{.*}}' -// CHECK-F-NEXT: TagType: Class -// CHECK-F-NEXT: Parents: -// CHECK-F-NEXT: - Type: Record -// CHECK-F-NEXT: Name: 'E' -// CHECK-F-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' -// CHECK-F-NEXT: VirtualParents: -// CHECK-F-NEXT: - Type: Record -// CHECK-F-NEXT: Name: 'D' -// CHECK-F-NEXT: USR: '0921737541208B8FA9BB42B60F78AC1D779AA054' -// CHECK-F-NEXT: ... - class X { class Y {}; - -// CHECK-Y: --- -// CHECK-Y-NEXT: USR: '641AB4A3D36399954ACDE29C7A8833032BF40472' -// CHECK-Y-NEXT: Name: 'Y' -// CHECK-Y-NEXT: Namespace: -// CHECK-Y-NEXT: - Type: Record -// CHECK-Y-NEXT: Name: 'X' -// CHECK-Y-NEXT: USR: 'CA7C7935730B5EACD25F080E9C83FA087CCDC75E' -// CHECK-Y-NEXT: DefLocation: -// CHECK-Y-NEXT: LineNumber: 197 -// CHECK-Y-NEXT: Filename: '{{.*}}' -// CHECK-Y-NEXT: TagType: Class -// CHECK-Y-NEXT: ... - }; -// CHECK-X: --- -// CHECK-X-NEXT: USR: 'CA7C7935730B5EACD25F080E9C83FA087CCDC75E' -// CHECK-X-NEXT: Name: 'X' -// CHECK-X-NEXT: DefLocation: -// CHECK-X-NEXT: LineNumber: 196 -// CHECK-X-NEXT: Filename: '{{.*}}' -// CHECK-X-NEXT: TagType: Class -// CHECK-X-NEXT: ... - -void H() { - class I {}; - -// CHECK-I: --- -// CHECK-I-NEXT: USR: '{{.*}}' -// CHECK-I-NEXT: Name: 'I' -// CHECK-I-NEXT: Namespace: -// CHECK-I-NEXT: - Type: Function -// CHECK-I-NEXT: Name: 'H' -// CHECK-I-NEXT: USR: 'B6AC4C5C9F2EA3F2B3ECE1A33D349F4EE502B24E' -// CHECK-I-NEXT: DefLocation: -// CHECK-I-NEXT: LineNumber: 224 -// CHECK-I-NEXT: Filename: 'test' -// CHECK-I-NEXT: TagType: Class -// CHECK-I-NEXT: ... - -} - -// CHECK-H: --- -// CHECK-H-NEXT: USR: 'B6AC4C5C9F2EA3F2B3ECE1A33D349F4EE502B24E' -// CHECK-H-NEXT: Name: 'H' -// CHECK-H-NEXT: DefLocation: -// CHECK-H-NEXT: LineNumber: 223 -// CHECK-H-NEXT: Filename: 'test' -// CHECK-H-NEXT: ReturnType: -// CHECK-H-NEXT: Type: -// CHECK-H-NEXT: Name: 'void' -// CHECK-H-NEXT: ... +// RUN: clang-doc --format=yaml --doxygen -p %t %t/test.cpp -output=%t/docs + + +// RUN: cat %t/docs/./C.yaml | FileCheck %s --check-prefix CHECK-0 +// CHECK-0: --- +// CHECK-0-NEXT: USR: '06B5F6A19BA9F6A832E127C9968282B94619B210' +// CHECK-0-NEXT: Name: 'C' +// CHECK-0-NEXT: DefLocation: +// CHECK-0-NEXT: LineNumber: 18 +// CHECK-0-NEXT: Filename: 'test' +// CHECK-0-NEXT: Members: +// CHECK-0-NEXT: - Type: +// CHECK-0-NEXT: Name: 'int' +// CHECK-0-NEXT: Name: 'i' +// CHECK-0-NEXT: ... + +// RUN: cat %t/docs/./A.yaml | FileCheck %s --check-prefix CHECK-1 +// CHECK-1: --- +// CHECK-1-NEXT: USR: 'ACE81AFA6627B4CEF2B456FB6E1252925674AF7E' +// CHECK-1-NEXT: Name: 'A' +// CHECK-1-NEXT: DefLocation: +// CHECK-1-NEXT: LineNumber: 12 +// CHECK-1-NEXT: Filename: 'test' +// CHECK-1-NEXT: TagType: Union +// CHECK-1-NEXT: Members: +// CHECK-1-NEXT: - Type: +// CHECK-1-NEXT: Name: 'int' +// CHECK-1-NEXT: Name: 'X' +// CHECK-1-NEXT: - Type: +// CHECK-1-NEXT: Name: 'int' +// CHECK-1-NEXT: Name: 'Y' +// CHECK-1-NEXT: ... + +// RUN: cat %t/docs/./F.yaml | FileCheck %s --check-prefix CHECK-2 +// CHECK-2: --- +// CHECK-2-NEXT: USR: 'E3B54702FABFF4037025BA194FC27C47006330B5' +// CHECK-2-NEXT: Name: 'F' +// CHECK-2-NEXT: DefLocation: +// CHECK-2-NEXT: LineNumber: 33 +// CHECK-2-NEXT: Filename: 'test' +// CHECK-2-NEXT: TagType: Class +// CHECK-2-NEXT: Parents: +// CHECK-2-NEXT: - Type: Record +// CHECK-2-NEXT: Name: 'E' +// CHECK-2-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' +// CHECK-2-NEXT: VirtualParents: +// CHECK-2-NEXT: - Type: Record +// CHECK-2-NEXT: Name: 'D' +// CHECK-2-NEXT: USR: '0921737541208B8FA9BB42B60F78AC1D779AA054' +// CHECK-2-NEXT: ... + +// RUN: cat %t/docs/./E.yaml | FileCheck %s --check-prefix CHECK-3 +// CHECK-3: --- +// CHECK-3-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' +// CHECK-3-NEXT: Name: 'E' +// CHECK-3-NEXT: DefLocation: +// CHECK-3-NEXT: LineNumber: 22 +// CHECK-3-NEXT: Filename: 'test' +// CHECK-3-NEXT: TagType: Class +// CHECK-3-NEXT: ChildFunctions: +// CHECK-3-NEXT: - USR: 'DEB4AC1CD9253CD9EF7FBE6BCAC506D77984ABD4' +// CHECK-3-NEXT: Name: 'E' +// CHECK-3-NEXT: Namespace: +// CHECK-3-NEXT: - Type: Record +// CHECK-3-NEXT: Name: 'E' +// CHECK-3-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' +// CHECK-3-NEXT: DefLocation: +// CHECK-3-NEXT: LineNumber: 24 +// CHECK-3-NEXT: Filename: 'test' +// CHECK-3-NEXT: IsMethod: true +// CHECK-3-NEXT: Parent: +// CHECK-3-NEXT: Type: Record +// CHECK-3-NEXT: Name: 'E' +// CHECK-3-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' +// CHECK-3-NEXT: ReturnType: +// CHECK-3-NEXT: Type: +// CHECK-3-NEXT: Name: 'void' +// CHECK-3-NEXT: - USR: 'BD2BDEBD423F80BACCEA75DE6D6622D355FC2D17' +// CHECK-3-NEXT: Name: '~E' +// CHECK-3-NEXT: Namespace: +// CHECK-3-NEXT: - Type: Record +// CHECK-3-NEXT: Name: 'E' +// CHECK-3-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' +// CHECK-3-NEXT: DefLocation: +// CHECK-3-NEXT: LineNumber: 25 +// CHECK-3-NEXT: Filename: 'test' +// CHECK-3-NEXT: IsMethod: true +// CHECK-3-NEXT: Parent: +// CHECK-3-NEXT: Type: Record +// CHECK-3-NEXT: Name: 'E' +// CHECK-3-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' +// CHECK-3-NEXT: ReturnType: +// CHECK-3-NEXT: Type: +// CHECK-3-NEXT: Name: 'void' +// CHECK-3-NEXT: - USR: '5093D428CDC62096A67547BA52566E4FB9404EEE' +// CHECK-3-NEXT: Name: 'ProtectedMethod' +// CHECK-3-NEXT: Namespace: +// CHECK-3-NEXT: - Type: Record +// CHECK-3-NEXT: Name: 'E' +// CHECK-3-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' +// CHECK-3-NEXT: DefLocation: +// CHECK-3-NEXT: LineNumber: 31 +// CHECK-3-NEXT: Filename: 'test' +// CHECK-3-NEXT: Location: +// CHECK-3-NEXT: - LineNumber: 28 +// CHECK-3-NEXT: Filename: 'test' +// CHECK-3-NEXT: IsMethod: true +// CHECK-3-NEXT: Parent: +// CHECK-3-NEXT: Type: Record +// CHECK-3-NEXT: Name: 'E' +// CHECK-3-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1' +// CHECK-3-NEXT: ReturnType: +// CHECK-3-NEXT: Type: +// CHECK-3-NEXT: Name: 'void' +// CHECK-3-NEXT: ... + +// RUN: cat %t/docs/./D.yaml | FileCheck %s --check-prefix CHECK-4 +// CHECK-4: --- +// CHECK-4-NEXT: USR: '0921737541208B8FA9BB42B60F78AC1D779AA054' +// CHECK-4-NEXT: Name: 'D' +// CHECK-4-NEXT: DefLocation: +// CHECK-4-NEXT: LineNumber: 20 +// CHECK-4-NEXT: Filename: 'test' +// CHECK-4-NEXT: TagType: Class +// CHECK-4-NEXT: ... + +// RUN: cat %t/docs/./X.yaml | FileCheck %s --check-prefix CHECK-5 +// CHECK-5: --- +// CHECK-5-NEXT: USR: 'CA7C7935730B5EACD25F080E9C83FA087CCDC75E' +// CHECK-5-NEXT: Name: 'X' +// CHECK-5-NEXT: DefLocation: +// CHECK-5-NEXT: LineNumber: 35 +// CHECK-5-NEXT: Filename: 'test' +// CHECK-5-NEXT: TagType: Class +// CHECK-5-NEXT: ... + +// RUN: cat %t/docs/./GlobalNamespace.yaml | FileCheck %s --check-prefix CHECK-6 +// CHECK-6: --- +// CHECK-6-NEXT: USR: '0000000000000000000000000000000000000000' +// CHECK-6-NEXT: ChildFunctions: +// CHECK-6-NEXT: - USR: 'B6AC4C5C9F2EA3F2B3ECE1A33D349F4EE502B24E' +// CHECK-6-NEXT: Name: 'H' +// CHECK-6-NEXT: DefLocation: +// CHECK-6-NEXT: LineNumber: 8 +// CHECK-6-NEXT: Filename: 'test' +// CHECK-6-NEXT: ReturnType: +// CHECK-6-NEXT: Type: +// CHECK-6-NEXT: Name: 'void' +// CHECK-6-NEXT: ChildEnums: +// CHECK-6-NEXT: - USR: 'FC07BD34D5E77782C263FA944447929EA8753740' +// CHECK-6-NEXT: Name: 'B' +// CHECK-6-NEXT: DefLocation: +// CHECK-6-NEXT: LineNumber: 14 +// CHECK-6-NEXT: Filename: 'test' +// CHECK-6-NEXT: Members: +// CHECK-6-NEXT: - 'X' +// CHECK-6-NEXT: - 'Y' +// CHECK-6-NEXT: - USR: '1E3438A08BA22025C0B46289FF0686F92C8924C5' +// CHECK-6-NEXT: Name: 'Bc' +// CHECK-6-NEXT: DefLocation: +// CHECK-6-NEXT: LineNumber: 16 +// CHECK-6-NEXT: Filename: 'test' +// CHECK-6-NEXT: Scoped: true +// CHECK-6-NEXT: Members: +// CHECK-6-NEXT: - 'A' +// CHECK-6-NEXT: - 'B' +// CHECK-6-NEXT: ... + +// RUN: cat %t/docs/H/I.yaml | FileCheck %s --check-prefix CHECK-7 +// CHECK-7: --- +// CHECK-7-NEXT: USR: 'E60CA1CC7048098A7F4A48C3A53D45A533BDC39B' +// CHECK-7-NEXT: Name: 'I' +// CHECK-7-NEXT: Namespace: +// CHECK-7-NEXT: - Type: Function +// CHECK-7-NEXT: Name: 'H' +// CHECK-7-NEXT: USR: 'B6AC4C5C9F2EA3F2B3ECE1A33D349F4EE502B24E' +// CHECK-7-NEXT: DefLocation: +// CHECK-7-NEXT: LineNumber: 9 +// CHECK-7-NEXT: Filename: 'test' +// CHECK-7-NEXT: TagType: Class +// CHECK-7-NEXT: ... + +// RUN: cat %t/docs/X/Y.yaml | FileCheck %s --check-prefix CHECK-8 +// CHECK-8: --- +// CHECK-8-NEXT: USR: '641AB4A3D36399954ACDE29C7A8833032BF40472' +// CHECK-8-NEXT: Name: 'Y' +// CHECK-8-NEXT: Namespace: +// CHECK-8-NEXT: - Type: Record +// CHECK-8-NEXT: Name: 'X' +// CHECK-8-NEXT: USR: 'CA7C7935730B5EACD25F080E9C83FA087CCDC75E' +// CHECK-8-NEXT: DefLocation: +// CHECK-8-NEXT: LineNumber: 36 +// CHECK-8-NEXT: Filename: 'test' +// CHECK-8-NEXT: TagType: Class +// CHECK-8-NEXT: ...