diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp index 068eec6599ea..e3532559a32f 100644 --- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp +++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp @@ -678,6 +678,19 @@ static std::unique_ptr genHTML(const CommentInfo &I) { return std::move(ParagraphComment); } + if (I.Kind == "BlockCommandComment") { + auto BlockComment = std::make_unique(HTMLTag::TAG_DIV); + BlockComment->Children.emplace_back( + std::make_unique(HTMLTag::TAG_DIV, I.Name)); + for (const auto &Child : I.Children) { + std::unique_ptr Node = genHTML(*Child); + if (Node) + BlockComment->Children.emplace_back(std::move(Node)); + } + if (BlockComment->Children.empty()) + return nullptr; + return std::move(BlockComment); + } if (I.Kind == "TextComment") { if (I.Text == "") return nullptr; diff --git a/clang-tools-extra/test/clang-doc/basic-project.test b/clang-tools-extra/test/clang-doc/basic-project.test index 2865ed4446e7..7c46c52bae68 100644 --- a/clang-tools-extra/test/clang-doc/basic-project.test +++ b/clang-tools-extra/test/clang-doc/basic-project.test @@ -56,32 +56,62 @@ // HTML-SHAPE:

class Shape

// HTML-SHAPE:

Defined at line 8 of file {{.*}}Shape.h

+// HTML-SHAPE:
brief
+// HTML-SHAPE:

Abstract base class for shapes.

// HTML-SHAPE:

Provides a common interface for different types of shapes.

// HTML-SHAPE:

Functions

// HTML-SHAPE:

area

// HTML-SHAPE:

public double area()

+// HTML-SHAPE:
brief
+// HTML-SHAPE:

Calculates the area of the shape.

// HTML-SHAPE:

perimeter

// HTML-SHAPE:

public double perimeter()

+// HTML-SHAPE:
brief
+// HTML-SHAPE:

Calculates the perimeter of the shape.

+// HTML-SHAPE:
return
+// HTML-SHAPE:

double The perimeter of the shape.

// HTML-SHAPE:

~Shape

// HTML-SHAPE:

public void ~Shape()

// HTML-SHAPE:

Defined at line 13 of file {{.*}}Shape.h

+// HTML-SHAPE:
brief
+// HTML-SHAPE:

Virtual destructor.

-// HTML-CALC:

class Calculator

-// HTML-CALC:

Defined at line 8 of file {{.*}}Calculator.h

-// HTML-CALC:

Provides basic arithmetic operations.

-// HTML-CALC:

Functions

-// HTML-CALC:

add

-// HTML-CALC:

public int add(int a, int b)

-// HTML-CALC:

Defined at line 3 of file {{.*}}Calculator.cpp

-// HTML-CALC:

subtract

-// HTML-CALC:

public int subtract(int a, int b)

-// HTML-CALC:

Defined at line 7 of file {{.*}}Calculator.cpp

-// HTML-CALC:

multiply

-// HTML-CALC:

public int multiply(int a, int b)

-// HTML-CALC:

Defined at line 11 of file {{.*}}Calculator.cpp

-// HTML-CALC:

divide

-// HTML-CALC:

public double divide(int a, int b)

-// HTML-CALC:

Defined at line 15 of file {{.*}}Calculator.cpp

+// HTML-CALC:

class Calculator

+// HTML-CALC:

Defined at line 8 of file {{.*}}Calculator.h

+// HTML-CALC:
brief
+// HTML-CALC:

A simple calculator class.

+// HTML-CALC:

Provides basic arithmetic operations.

+// HTML-CALC:

Functions

+// HTML-CALC:

add

+// HTML-CALC:

public int add(int a, int b)

+// HTML-CALC:

Defined at line 3 of file {{.*}}Calculator.cpp

+// HTML-CALC:
brief
+// HTML-CALC:

Adds two integers.

+// HTML-CALC:
return
+// HTML-CALC:

int The sum of a and b.

+// HTML-CALC:

subtract

+// HTML-CALC:

public int subtract(int a, int b)

+// HTML-CALC:

Defined at line 7 of file {{.*}}Calculator.cpp

+// HTML-CALC:
brief
+// HTML-CALC:

Subtracts the second integer from the first.

+// HTML-CALC:
return
+// HTML-CALC:

int The result of a - b.

+// HTML-CALC:

multiply

+// HTML-CALC:

public int multiply(int a, int b)

+// HTML-CALC:

Defined at line 11 of file {{.*}}Calculator.cpp

+// HTML-CALC:
brief
+// HTML-CALC:

Multiplies two integers.

+// HTML-CALC:
return
+// HTML-CALC:

int The product of a and b.

+// HTML-CALC:

divide

+// HTML-CALC:

public double divide(int a, int b)

+// HTML-CALC:

Defined at line 15 of file {{.*}}Calculator.cpp

+// HTML-CALC:
brief
+// HTML-CALC:

Divides the first integer by the second.

+// HTML-CALC:
return
+// HTML-CALC:

double The result of a / b.

+// HTML-CALC:
throw
+// HTML-CALC:

if b is zero.

// HTML-RECTANGLE:

class Rectangle

// HTML-RECTANGLE:

Defined at line 10 of file {{.*}}Rectangle.h

@@ -99,15 +129,27 @@ // HTML-RECTANGLE:

Rectangle

// HTML-RECTANGLE:

public void Rectangle(double width, double height)

// HTML-RECTANGLE:

Defined at line 3 of file {{.*}}Rectangle.cpp

+// HTML-RECTANGLE:
brief
+// HTML-RECTANGLE:

Constructs a new Rectangle object.

// HTML-RECTANGLE:

area

// HTML-RECTANGLE:

public double area()

// HTML-RECTANGLE:

Defined at line 6 of file {{.*}}Rectangle.cpp

+// HTML-RECTANGLE:
brief
+// HTML-RECTANGLE:

Calculates the area of the rectangle.

+// HTML-RECTANGLE:
return
+// HTML-RECTANGLE:

double The area of the rectangle.

// HTML-RECTANGLE:

perimeter

// HTML-RECTANGLE:

public double perimeter()

// HTML-RECTANGLE:

Defined at line 10 of file {{.*}}Rectangle.cpp

+// HTML-RECTANGLE:
brief
+// HTML-RECTANGLE:

Calculates the perimeter of the rectangle.

+// HTML-RECTANGLE:
return
+// HTML-RECTANGLE:

double The perimeter of the rectangle.

// HTML-CIRCLE:

class Circle

// HTML-CIRCLE:

Defined at line 10 of file {{.*}}Circle.h

+// HTML-CIRCLE:
brief
+// HTML-CIRCLE:

Circle class derived from Shape.

// HTML-CIRCLE:

Represents a circle with a given radius.

// HTML-CIRCLE:

// HTML-CIRCLE: Inherits from @@ -120,12 +162,22 @@ // HTML-CIRCLE:

Circle

// HTML-CIRCLE:

public void Circle(double radius)

// HTML-CIRCLE:

Defined at line 3 of file {{.*}}Circle.cpp

+// HTML-CIRCLE:
brief
+// HTML-CIRCLE:

Constructs a new Circle object.

// HTML-CIRCLE:

area

// HTML-CIRCLE:

public double area()

// HTML-CIRCLE:

Defined at line 5 of file {{.*}}Circle.cpp

+// HTML-CIRCLE:
brief
+// HTML-CIRCLE:

Calculates the area of the circle.

+// HTML-CIRCLE:
return
+// HTML-CIRCLE:

double The area of the circle.

// HTML-CIRCLE:

perimeter

// HTML-CIRCLE:

public double perimeter()

// HTML-CIRCLE:

Defined at line 9 of file {{.*}}Circle.cpp

+// HTML-CIRCLE:
brief
+// HTML-CIRCLE:

Calculates the perimeter of the circle.

+// HTML-CIRCLE:
return
+// HTML-CIRCLE:

double The perimeter of the circle.

// MD-CALC: # class Calculator // MD-CALC: *Defined at .{{[\/]}}include{{[\/]}}Calculator.h#8*