Skip to content

Commit c3a18a5

Browse files
committed
feat: dependency extraction improvements
1 parent 1509e20 commit c3a18a5

File tree

13 files changed

+1053
-894
lines changed

13 files changed

+1053
-894
lines changed

include/mrdox/Config.hpp

+29
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,37 @@ class MRDOX_DECL
4242
Config() noexcept;
4343

4444
public:
45+
struct ExtractOptions
46+
{
47+
enum class Policy
48+
{
49+
Always,
50+
Dependency,
51+
Never
52+
};
53+
54+
/** Extraction policy for references to external declarations.
55+
56+
This determines how declarations which are referenced by
57+
explicitly extracted declarations are extracted.
58+
59+
Given a function parameter of type `std::string`, `std::string`
60+
would be extracted if this option is set to `Policy::Always`.
61+
*/
62+
Policy referencedDeclarations = Policy::Dependency;
63+
64+
Policy anonymousNamespaces = Policy::Always;
65+
66+
Policy inaccessibleMembers = Policy::Always;
67+
68+
Policy inaccessibleBases = Policy::Always;
69+
};
70+
4571
struct Settings
4672
{
73+
74+
ExtractOptions extractOptions;
75+
4776
/** `true` if anonymous namespace members should be extracted and displayed.
4877
4978
In some cases anonymous namespace members will

include/mrdox/Metadata/Type.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ enum class TypeKind
4545
MemberPointer,
4646
Array,
4747
Function,
48+
// KRYSTIAN FIXME: get rid of PackTypeInfo
4849
Pack
4950
};
5051

share/mrdox/addons/generator/asciidoc/partials/declarator-before.adoc.hbs

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
{{#if pointee-type~}}
22
{{~>declarator-before pointee-type~}}
33
{{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))}}({{/if~}}
4-
{{else if element-type~}}
5-
{{~>declarator-before element-type~}}
6-
{{else if return-type~}}
7-
{{~>declarator-before return-type~}}
8-
{{else if pattern-type~}}
9-
{{~>declarator-before pattern-type}}...
104
{{~/if~}}
11-
{{#if parent-type~}}
12-
{{#if parent-type}}{{>declarator parent-type}}::{{/if~}}
13-
{{/if~}}
5+
{{#if element-type~}}{{~>declarator-before element-type~}}{{/if~}}
6+
{{#if return-type~}}{{~>declarator-before return-type~}}{{/if~}}
7+
{{#if pattern-type~}}{{~>declarator-before pattern-type}}...{{/if~}}
8+
{{#if parent-type~}}{{>declarator parent-type}}::{{/if~}}
149
{{#if (eq kind "lvalue-reference")}}&{{/if~}}
1510
{{#if (eq kind "rvalue-reference")}}&&{{/if~}}
1611
{{#if (eq kind "pointer")}}*{{/if~}}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{>declarator-before .~}}
22
{{~#if decl-name}} {{decl-name~}}
3-
{{~#if decl-name-targs}}{{>template-args args=decl-name-targs}}{{/if~}}
3+
{{~#if decl-name-targs~}}{{>template-args args=decl-name-targs}}{{~/if~}}
44
{{~/if~}}
55
{{~>declarator-after}}

share/mrdox/addons/generator/asciidoc/partials/function-sig.adoc.hbs

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
{{#if (eq class "normal")~}}
1313
{{>declarator-before return}}
1414
15-
{{name~}}
1615
{{#if (eq template.kind "explicit")~}}
16+
{{#if template.primary.id~}}{{>xref template.primary}}[{{name}}]{{else}}{{name}}{{/if~}}
1717
{{~>template-args args=template.args~}}
18+
{{else~}}
19+
{{name~}}
1820
{{/if~}}
1921
{{else if (neq class "conversion")~}}
2022
{{name~}}

share/mrdox/addons/generator/asciidoc/partials/record.adoc.hbs

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
----
1010
{{#if template}}{{>template-head template}}
1111
{{/if~}}
12-
{{symbol.tag}} {{symbol.name~}}
13-
{{#if (or (eq symbol.template.kind "explicit") (eq symbol.template.kind "partial"))~}}
14-
{{~>template-args args=symbol.template.args}}
12+
{{#if (or (eq template.kind "explicit") (eq template.kind "partial"))~}}
13+
{{tag}} {{#if template.primary.id~}}{{>xref template.primary}}[{{name}}]{{else}}{{name}}{{/if~}}
14+
{{~>template-args args=template.args~}}
15+
{{else~}}
16+
{{tag}} {{name~}}
1517
{{/if~}}
1618
{{#unless symbol.bases}}
1719
;

share/mrdox/addons/generator/asciidoc/partials/variable.adoc.hbs

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
{{/if~}}
1616
{{#if symbol.isThreadLocal}}thread_local
1717
{{/if~}}
18-
{{>declarator-before symbol.type}} {{symbol.name~}}
19-
{{#if (or (eq symbol.template.kind "explicit") (eq symbol.template.kind "partial"))~}}
20-
{{~>template-args args=symbol.template.args}}
18+
{{#if (or (eq template.kind "explicit") (eq template.kind "partial"))~}}
19+
{{>declarator-before symbol.type}} {{#if template.primary.id~}}{{>xref template.primary}}[{{name}}]{{else}}{{name}}{{/if~}}
20+
{{~>template-args args=template.args~}}
21+
{{else~}}
22+
{{>declarator-before symbol.type}} {{name~}}
2123
{{/if~}}
2224
{{>declarator-after symbol.type~}}
2325
;

0 commit comments

Comments
 (0)