HTML(HTMLGenerator::Format,
"Generator for HTML output.");
-// This anchor is used to force the linker to link in the generated object file
-// and thus register the generator.
+// This anchor is used to force the linker to link in the generated object
+// file and thus register the generator.
volatile int HTMLGeneratorAnchorSource = 0;
} // namespace doc
Index: clang-tools-extra/clang-doc/MDGenerator.cpp
===================================================================
--- clang-tools-extra/clang-doc/MDGenerator.cpp
+++ clang-tools-extra/clang-doc/MDGenerator.cpp
@@ -20,11 +20,11 @@
// Markdown generation
-std::string genItalic(const Twine &Text) { return "*" + Text.str() + "*"; }
+static std::string genItalic(const Twine &Text) { return "*" + Text.str() + "*"; }
-std::string genEmphasis(const Twine &Text) { return "**" + Text.str() + "**"; }
+static std::string genEmphasis(const Twine &Text) { return "**" + Text.str() + "**"; }
-std::string genLink(const Twine &Text, const Twine &Link) {
+static std::string genLink(const Twine &Text, const Twine &Link) {
return "[" + Text.str() + "](" + Link.str() + ")";
}
@@ -92,7 +92,7 @@
}
}
-void genMarkdown(const EnumInfo &I, llvm::raw_ostream &OS) {
+static void genMarkdown(const EnumInfo &I, llvm::raw_ostream &OS) {
if (I.Scoped)
writeLine("| enum class " + I.Name + " |", OS);
else
@@ -112,7 +112,7 @@
writeDescription(C, OS);
}
-void genMarkdown(const FunctionInfo &I, llvm::raw_ostream &OS) {
+static void genMarkdown(const FunctionInfo &I, llvm::raw_ostream &OS) {
std::string Buffer;
llvm::raw_string_ostream Stream(Buffer);
bool First = true;
@@ -139,7 +139,7 @@
writeDescription(C, OS);
}
-void genMarkdown(const NamespaceInfo &I, llvm::raw_ostream &OS) {
+static void genMarkdown(const NamespaceInfo &I, llvm::raw_ostream &OS) {
if (I.Name == "")
writeHeader("Global Namespace", 1, OS);
else
@@ -178,7 +178,7 @@
}
}
-void genMarkdown(const RecordInfo &I, llvm::raw_ostream &OS) {
+static void genMarkdown(const RecordInfo &I, llvm::raw_ostream &OS) {
writeHeader(getTagType(I.TagType) + " " + I.Name, 1, OS);
if (I.DefLoc)
writeFileDefinition(I.DefLoc.getValue(), OS);
Index: clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
===================================================================
--- clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
+++ clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
@@ -40,16 +40,31 @@
llvm::raw_string_ostream Actual(Buffer);
auto Err = G->generateDocForInfo(&I, Actual);
assert(!Err);
- std::string Expected = R"raw(namespace Namespace
-Namespaces
-ChildNamespace
-Records
-ChildStruct
-Functions
-OneFunction
- OneFunction()
-Enums
-enum OneEnum
+ std::string Expected = R"raw(
+
+namespace Namespace
+
+
namespace Namespace
+
Namespaces
+
+
Records
+
+
Functions
+
+
OneFunction
+
+ OneFunction()
+
+
+
Enums
+
+
enum OneEnum
+
+
)raw";
EXPECT_EQ(Expected, Actual.str());
@@ -80,18 +95,37 @@
llvm::raw_string_ostream Actual(Buffer);
auto Err = G->generateDocForInfo(&I, Actual);
assert(!Err);
- std::string Expected = R"raw(class r
-Defined at line 10 of test.cpp
-Inherits from F, G
-Members
-private int X
-Records
-ChildStruct
-Functions
-OneFunction
- OneFunction()
-Enums
-enum OneEnum
+ std::string Expected = R"raw(
+
+class r
+
+
class r
+
+ Defined at line 10 of test.cpp
+
+
+ Inherits from F, G
+
+
Members
+
+
Records
+
+
Functions
+
+
OneFunction
+
+ OneFunction()
+
+
+
Enums
+
+
enum OneEnum
+
+
)raw";
EXPECT_EQ(Expected, Actual.str());
@@ -116,9 +150,18 @@
llvm::raw_string_ostream Actual(Buffer);
auto Err = G->generateDocForInfo(&I, Actual);
assert(!Err);
- std::string Expected = R"raw(f
-void f(int P)
-Defined at line 10 of test.cpp
+ std::string Expected = R"raw(
+
+
+
+
f
+
+ void f(int P)
+
+
+ Defined at line 10 of test.cpp
+
+
)raw";
EXPECT_EQ(Expected, Actual.str());
@@ -141,11 +184,18 @@
llvm::raw_string_ostream Actual(Buffer);
auto Err = G->generateDocForInfo(&I, Actual);
assert(!Err);
- std::string Expected = R"raw(enum class e
-
-Defined at line 10 of test.cpp
+ std::string Expected = R"raw(
+
+
+
+
enum class e
+
+
+ Defined at line 10 of test.cpp
+
+
)raw";
EXPECT_EQ(Expected, Actual.str());
@@ -194,12 +244,29 @@
llvm::raw_string_ostream Actual(Buffer);
auto Err = G->generateDocForInfo(&I, Actual);
assert(!Err);
- std::string Expected = R"raw(f
-void f(int I, int J)
-Defined at line 10 of test.cpp
-
- Brief description.
- Extended description that continues onto the next line.
+ std::string Expected = R"raw(
+
+
+
+
f
+
+ void f(int I, int J)
+
+
+ Defined at line 10 of test.cpp
+
+
+
+
+ Brief description.
+
+
+ Extended description that
+ continues onto the next line.
+
+
+
+
)raw";
EXPECT_EQ(Expected, Actual.str());