Skip to content

Commit

Permalink
feat: dependency extraction improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sdkrystian committed Oct 6, 2023
1 parent 1509e20 commit c3a18a5
Show file tree
Hide file tree
Showing 13 changed files with 1,053 additions and 894 deletions.
29 changes: 29 additions & 0 deletions include/mrdox/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,37 @@ class MRDOX_DECL
Config() noexcept;

public:
struct ExtractOptions
{
enum class Policy
{
Always,
Dependency,
Never
};

/** Extraction policy for references to external declarations.
This determines how declarations which are referenced by
explicitly extracted declarations are extracted.
Given a function parameter of type `std::string`, `std::string`
would be extracted if this option is set to `Policy::Always`.
*/
Policy referencedDeclarations = Policy::Dependency;

Policy anonymousNamespaces = Policy::Always;

Policy inaccessibleMembers = Policy::Always;

Policy inaccessibleBases = Policy::Always;
};

struct Settings
{

ExtractOptions extractOptions;

/** `true` if anonymous namespace members should be extracted and displayed.
In some cases anonymous namespace members will
Expand Down
1 change: 1 addition & 0 deletions include/mrdox/Metadata/Type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ enum class TypeKind
MemberPointer,
Array,
Function,
// KRYSTIAN FIXME: get rid of PackTypeInfo
Pack
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
{{#if pointee-type~}}
{{~>declarator-before pointee-type~}}
{{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))}}({{/if~}}
{{else if element-type~}}
{{~>declarator-before element-type~}}
{{else if return-type~}}
{{~>declarator-before return-type~}}
{{else if pattern-type~}}
{{~>declarator-before pattern-type}}...
{{~/if~}}
{{#if parent-type~}}
{{#if parent-type}}{{>declarator parent-type}}::{{/if~}}
{{/if~}}
{{#if element-type~}}{{~>declarator-before element-type~}}{{/if~}}
{{#if return-type~}}{{~>declarator-before return-type~}}{{/if~}}
{{#if pattern-type~}}{{~>declarator-before pattern-type}}...{{/if~}}
{{#if parent-type~}}{{>declarator parent-type}}::{{/if~}}
{{#if (eq kind "lvalue-reference")}}&{{/if~}}
{{#if (eq kind "rvalue-reference")}}&&{{/if~}}
{{#if (eq kind "pointer")}}*{{/if~}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{>declarator-before .~}}
{{~#if decl-name}} {{decl-name~}}
{{~#if decl-name-targs}}{{>template-args args=decl-name-targs}}{{/if~}}
{{~#if decl-name-targs~}}{{>template-args args=decl-name-targs}}{{~/if~}}
{{~/if~}}
{{~>declarator-after}}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
{{#if (eq class "normal")~}}
{{>declarator-before return}}
{{name~}}
{{#if (eq template.kind "explicit")~}}
{{#if template.primary.id~}}{{>xref template.primary}}[{{name}}]{{else}}{{name}}{{/if~}}
{{~>template-args args=template.args~}}
{{else~}}
{{name~}}
{{/if~}}
{{else if (neq class "conversion")~}}
{{name~}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
----
{{#if template}}{{>template-head template}}
{{/if~}}
{{symbol.tag}} {{symbol.name~}}
{{#if (or (eq symbol.template.kind "explicit") (eq symbol.template.kind "partial"))~}}
{{~>template-args args=symbol.template.args}}
{{#if (or (eq template.kind "explicit") (eq template.kind "partial"))~}}
{{tag}} {{#if template.primary.id~}}{{>xref template.primary}}[{{name}}]{{else}}{{name}}{{/if~}}
{{~>template-args args=template.args~}}
{{else~}}
{{tag}} {{name~}}
{{/if~}}
{{#unless symbol.bases}}
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
{{/if~}}
{{#if symbol.isThreadLocal}}thread_local
{{/if~}}
{{>declarator-before symbol.type}} {{symbol.name~}}
{{#if (or (eq symbol.template.kind "explicit") (eq symbol.template.kind "partial"))~}}
{{~>template-args args=symbol.template.args}}
{{#if (or (eq template.kind "explicit") (eq template.kind "partial"))~}}
{{>declarator-before symbol.type}} {{#if template.primary.id~}}{{>xref template.primary}}[{{name}}]{{else}}{{name}}{{/if~}}
{{~>template-args args=template.args~}}
{{else~}}
{{>declarator-before symbol.type}} {{name~}}
{{/if~}}
{{>declarator-after symbol.type~}}
;
Expand Down
Loading

0 comments on commit c3a18a5

Please sign in to comment.