aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.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/HTMLGeneratorTest.cpp
parent13f7ddff17ba1f4c5a51c83af1c83cb501ad0653 (diff)
downloadllvm-2c1c9a240776e5ccfb29b8a22bb32bb7e87ac2dd.zip
llvm-2c1c9a240776e5ccfb29b8a22bb32bb7e87ac2dd.tar.gz
llvm-2c1c9a240776e5ccfb29b8a22bb32bb7e87ac2dd.tar.bz2
[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/HTMLGeneratorTest.cpp')
-rw-r--r--clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp b/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
index fe6bc61..e95ceb8 100644
--- a/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
+++ b/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
@@ -57,7 +57,7 @@ TEST(HTMLGeneratorTest, emitNamespaceHTML) {
<div>
<h3>OneFunction</h3>
<p>
- OneFunction()
+ OneFunction()
</p>
</div>
<h2>Enums</h2>
@@ -73,14 +73,16 @@ TEST(HTMLGeneratorTest, emitNamespaceHTML) {
TEST(HTMLGeneratorTest, emitRecordHTML) {
RecordInfo I;
I.Name = "r";
+ I.Path = "X/Y/Z";
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", "X/Y", "X", AccessSpecifier::AS_private);
I.TagType = TagTypeKind::TTK_Class;
- I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
+ I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record,
+ llvm::SmallString<128>("path/to"));
I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
I.ChildRecords.emplace_back(EmptySID, "ChildStruct", InfoType::IT_record);
@@ -104,11 +106,13 @@ TEST(HTMLGeneratorTest, emitRecordHTML) {
Defined at line 10 of test.cpp
</p>
<p>
- Inherits from F, G
+ Inherits from
+ <a href="../../../path/to/F.html">F</a>
+ , G
</p>
<h2>Members</h2>
<ul>
- <li>private int X</li>
+ <li>private <a href="../int.html">int</a> X</li>
</ul>
<h2>Records</h2>
<ul>
@@ -118,7 +122,7 @@ TEST(HTMLGeneratorTest, emitRecordHTML) {
<div>
<h3>OneFunction</h3>
<p>
- OneFunction()
+ OneFunction()
</p>
</div>
<h2>Enums</h2>
@@ -139,8 +143,8 @@ TEST(HTMLGeneratorTest, emitFunctionHTML) {
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, "float", InfoType::IT_default, "path/to");
+ I.Params.emplace_back("int", "path/to", "P");
I.IsMethod = true;
I.Parent = Reference(EmptySID, "Parent", InfoType::IT_record);
@@ -156,7 +160,10 @@ TEST(HTMLGeneratorTest, emitFunctionHTML) {
<div>
<h3>f</h3>
<p>
- void f(int P)
+ <a href="path/to/float.html">float</a>
+ f(
+ <a href="path/to/int.html">int</a>
+ P)
</p>
<p>
Defined at line 10 of test.cpp
@@ -261,8 +268,7 @@ TEST(HTMLGeneratorTest, emitCommentHTML) {
Brief description.
</p>
<p>
- Extended description that
- continues onto the next line.
+ Extended description that continues onto the next line.
</p>
</div>
</div>