forked from foxglove/mcap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhdoc.patch
94 lines (87 loc) · 4.2 KB
/
hdoc.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
diff --git a/meson.build b/meson.build
index c1daf2e..b8b981d 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('hdoc', 'cpp', version: '1.2.2', default_options: ['cpp_std=c++17', 'warning_level=3'])
+project('hdoc', 'cpp', 'c', version: '1.2.2', default_options: ['cpp_std=c++17', 'warning_level=3'])
dep_llvm = dependency('LLVM', include_type: 'system')
clang_modules = [
diff --git a/src/serde/HTMLWriter.cpp b/src/serde/HTMLWriter.cpp
index 2d9e22b..aeda844 100644
--- a/src/serde/HTMLWriter.cpp
+++ b/src/serde/HTMLWriter.cpp
@@ -18,6 +18,23 @@
#include "support/StringUtils.hpp"
#include "types/Symbols.hpp"
+static bool isMcapInternal(const hdoc::types::Symbol& symbol, const hdoc::types::Index& index) {
+ const auto* current = &symbol;
+ while (true) {
+ if (index.namespaces.contains(current->parentNamespaceID)) {
+ current = &index.namespaces.entries.at(current->parentNamespaceID);
+ } else if (index.records.contains(current->parentNamespaceID)) {
+ current = &index.records.entries.at(current->parentNamespaceID);
+ } else {
+ break;
+ }
+ if (current->name == std::string("internal")) {
+ return true;
+ }
+ }
+ return false;
+}
+
/// Implementation of to_string() for Clang member variable access specifier
static std::string to_string(const clang::AccessSpecifier& access) {
switch (access) {
@@ -189,7 +206,6 @@ static void printNewPage(const hdoc::types::Config& cfg,
auto aside = CTML::Node("aside.column is-one-fifth");
auto menuUL = CTML::Node("ul.menu-list");
- aside.AddChild(CTML::Node("a.is-button is-size-1", "hdoc").SetAttr("href", "https://hdoc.io"));
menuUL.AddChild(CTML::Node("p.is-size-4", cfg.projectName + " " + cfg.projectVersion));
menuUL.AddChild(CTML::Node("p.menu-label", "Navigation"));
menuUL.AddChild(CTML::Node("li").AddChild(CTML::Node("a", "Home").SetAttr("href", "index.html")));
@@ -221,7 +237,7 @@ static void printNewPage(const hdoc::types::Config& cfg,
CTML::Node p1 = CTML::Node("p", "Documentation for " + cfg.projectName + " " + cfg.projectVersion + ".");
CTML::Node p2 = CTML::Node("p", "Generated by ")
.AddChild(CTML::Node("a", "hdoc").SetAttr("href", "https://hdoc.io/"))
- .AppendText(" version " + cfg.hdocVersion + " on " + cfg.timestamp + ".");
+ .AppendText(" version " + cfg.hdocVersion + ".");
CTML::Node p3 = CTML::Node("p.has-text-grey-light", "19AD43E11B2996");
html.AppendNodeToBody(CTML::Node("footer.footer").AddChild(p1).AddChild(p2).AddChild(p3));
@@ -500,6 +516,9 @@ void hdoc::serde::HTMLWriter::printFunctions() const {
CTML::Node ul("ul");
for (const auto& id : getSortedIDs(map2vec(this->index->functions), this->index->functions)) {
const auto& f = this->index->functions.entries.at(id);
+ if (isMcapInternal(f, *this->index)) {
+ continue;
+ }
if (f.isRecordMember) {
continue;
}
@@ -575,7 +594,7 @@ static void printMemberVariables(const hdoc::types::RecordSymbol& c, CTML::Node&
uint64_t numVars = 0;
for (const hdoc::types::MemberVariable& var : c.vars) {
- if (isInherited == true && var.access == clang::AS_private) {
+ if (var.access == clang::AS_private) {
continue;
}
@@ -717,6 +736,9 @@ void hdoc::serde::HTMLWriter::printRecord(const hdoc::types::RecordSymbol& c) co
CTML::Node ul("ul");
for (auto methodID : sortedMethodIDs) {
const hdoc::types::FunctionSymbol m = this->index->functions.entries.at(methodID);
+ if (m.access == clang::AS_private) {
+ continue;
+ }
// Divide up the full function declaration so its name can be bold in the HTML
const uint64_t nameLen = m.name.size();
@@ -772,6 +794,9 @@ void hdoc::serde::HTMLWriter::printRecords() const {
CTML::Node ul("ul");
for (const auto& id : getSortedIDs(map2vec(this->index->records), this->index->records)) {
const auto& c = this->index->records.entries.at(id);
+ if (isMcapInternal(c, *this->index)) {
+ continue;
+ }
ul.AddChild(CTML::Node("li")
.AddChild(CTML::Node("a.is-family-code", c.type + " " + c.name).SetAttr("href", c.url()))
.AppendText(getSymbolBlurb(c)));