summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
diff options
context:
space:
mode:
authorJulie Hockett <juliehockett@google.com>2019-07-12 18:32:00 +0000
committerJulie Hockett <juliehockett@google.com>2019-07-12 18:32:00 +0000
commit2c1c9a240776e5ccfb29b8a22bb32bb7e87ac2dd (patch)
tree01de292be1b791cca0047d25e1bed39d62e13011 /clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
parent13f7ddff17ba1f4c5a51c83af1c83cb501ad0653 (diff)
downloadbcm5719-llvm-2c1c9a240776e5ccfb29b8a22bb32bb7e87ac2dd.tar.gz
bcm5719-llvm-2c1c9a240776e5ccfb29b8a22bb32bb7e87ac2dd.zip
[clang-doc] Add html links to references
<a> 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
Diffstat (limited to 'clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp')
-rw-r--r--clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp22
1 files changed, 17 insertions, 5 deletions
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<Generator> 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());
OpenPOWER on IntegriCloud