From 2c1c9a240776e5ccfb29b8a22bb32bb7e87ac2dd Mon Sep 17 00:00:00 2001 From: Julie Hockett Date: Fri, 12 Jul 2019 18:32:00 +0000 Subject: [clang-doc] Add html links to references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tags are added for the parents and members of records and return type and params of functions. The link redirects to the reference's info file. The directory path where each info file will be saved is now generated in the serialization phase and stored as an attribute in each Info. Bitcode writer and reader were modified to handle the new attributes. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com). Differential Revision: https://reviews.llvm.org/D63663 llvm-svn: 365937 --- .../unittests/clang-doc/YAMLGeneratorTest.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp') diff --git a/clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp b/clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp index 42849f77cd3..e2295525bdd 100644 --- a/clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp +++ b/clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp @@ -25,6 +25,7 @@ std::unique_ptr getYAMLGenerator() { TEST(YAMLGeneratorTest, emitNamespaceYAML) { NamespaceInfo I; I.Name = "Namespace"; + I.Path = "path/to/A"; I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace); I.ChildNamespaces.emplace_back(EmptySID, "ChildNamespace", @@ -45,6 +46,7 @@ TEST(YAMLGeneratorTest, emitNamespaceYAML) { R"raw(--- USR: '0000000000000000000000000000000000000000' Name: 'Namespace' +Path: 'path/to/A' Namespace: - Type: Namespace Name: 'A' @@ -69,15 +71,18 @@ ChildEnums: TEST(YAMLGeneratorTest, emitRecordYAML) { RecordInfo I; I.Name = "r"; + I.Path = "path/to/r"; I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace); I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"}); I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"}); - I.Members.emplace_back("int", "X", AccessSpecifier::AS_private); + I.Members.emplace_back("int", "path/to/int", "X", + AccessSpecifier::AS_private); I.TagType = TagTypeKind::TTK_Class; - I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record); - I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record); + I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record, "path/to/F"); + I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record, + "path/to/G"); I.ChildRecords.emplace_back(EmptySID, "ChildStruct", InfoType::IT_record); I.ChildFunctions.emplace_back(); @@ -95,6 +100,7 @@ TEST(YAMLGeneratorTest, emitRecordYAML) { R"raw(--- USR: '0000000000000000000000000000000000000000' Name: 'r' +Path: 'path/to/r' Namespace: - Type: Namespace Name: 'A' @@ -108,14 +114,17 @@ TagType: Class Members: - Type: Name: 'int' + Path: 'path/to/int' Name: 'X' Access: Private Parents: - Type: Record Name: 'F' + Path: 'path/to/F' VirtualParents: - Type: Record Name: 'G' + Path: 'path/to/G' ChildRecords: - Type: Record Name: 'ChildStruct' @@ -139,8 +148,9 @@ TEST(YAMLGeneratorTest, emitFunctionYAML) { I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"}); I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"}); - I.ReturnType = TypeInfo(EmptySID, "void", InfoType::IT_default); - I.Params.emplace_back("int", "P"); + I.ReturnType = + TypeInfo(EmptySID, "void", InfoType::IT_default, "path/to/void"); + I.Params.emplace_back("int", "path/to/int", "P"); I.IsMethod = true; I.Parent = Reference(EmptySID, "Parent", InfoType::IT_record); @@ -170,10 +180,12 @@ Parent: Params: - Type: Name: 'int' + Path: 'path/to/int' Name: 'P' ReturnType: Type: Name: 'void' + Path: 'path/to/void' ... )raw"; EXPECT_EQ(Expected, Actual.str()); -- cgit v1.2.3