Skip to content

Commit 6a0a540

Browse files
committed
chore: tidy up config settings
1 parent 6c6a621 commit 6a0a540

File tree

8 files changed

+96
-31
lines changed

8 files changed

+96
-31
lines changed

docs/modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
* xref:index.adoc[]
22
* xref:install.adoc[]
33
* xref:usage.adoc[]
4+
* xref:config-file.adoc[]
45
* xref:commands.adoc[]
56
* xref:design-notes.adoc[]
67
* xref:contribute.adoc[]
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
= The Configuration File
2+
3+
[,yaml]
4+
----
5+
concurrency: # <.>
6+
defines: # <.>
7+
ignore-failures: # <.>
8+
include-anonymous: # <.>
9+
include-private: # <.>
10+
input:
11+
include: # <.>
12+
multipage: # <.>
13+
source-root: # <.>
14+
----
15+
<.> Optional `concurrency` key
16+
<.> Optional `defines` key
17+
<.> Optional `ignore-failures` key
18+
<.> Optional `include-anonymous` key
19+
<.> Optional `include-private` key
20+
<.> Optional `include` key
21+
<.> Optional `multipage` key
22+
<.> Optional `source-root` key
23+
24+
== Available configuration keys
25+
26+
[cols="3,6,1"]
27+
|===
28+
|Keys |Description |Required
29+
30+
|concurrency
31+
|The amount of parallelism desired. 0 to use
32+
the hardware-suggested concurrency.
33+
|No
34+
35+
|defines
36+
|Additional preprocessor directives in the form "NAME=VALUE".
37+
|No
38+
39+
|ignore-failures
40+
|Whether to ignore failures during symbol extraction. `true` or `false`.
41+
|No
42+
43+
|include-anonymous
44+
|Whether to extract symbols from anonymous namespaces. `true` or `false`.
45+
|No
46+
47+
|include-private
48+
|Whether to extract private members. `true` or `false`.
49+
|No
50+
51+
|include
52+
|The amount of parallelism desired. 0 to use
53+
the hardware-suggested concurrency.
54+
|No
55+
56+
|multipage
57+
|Whether to emit the reference as a set of files or just one file. `true` or `false`.
58+
|No
59+
60+
|source-root
61+
|The absolute or relative path to the directory containing the
62+
input file hierarchy.
63+
|No
64+
|===

include/mrdox/Config.hpp

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,20 @@ class MRDOX_DECL
4444
public:
4545
struct Settings
4646
{
47-
/** `true` if AST visitation failures should not stop the program.
47+
/** The level of concurrency desired.
4848
49-
@code
50-
ignore-failures: true
51-
@endcode
49+
This will always be greater than zero.
5250
*/
53-
bool ignoreFailures = false;
51+
unsigned int concurrency = 0;
5452

55-
/** `true` if output should consist of multiple files.
53+
/** `true` if anonymous namespace members should be extracted and displayed.
54+
55+
In some cases anonymous namespace members will
56+
be listed even if this configuration value is set to
57+
`false`. For example, this may occur for a class derived
58+
from one declared within an anonymous namespace.
5659
*/
57-
bool multiPage = false;
60+
bool includeAnonymous = true;
5861

5962
/** `true` if private members should be extracted and displayed.
6063
@@ -65,20 +68,9 @@ class MRDOX_DECL
6568
*/
6669
bool includePrivate = false;
6770

68-
/** `true` if anonymous namespace members should be extracted and displayed.
69-
70-
In some cases anonymous namespace members will
71-
be listed even if this configuration value is set to
72-
`false`. For example, this may occur for a class derived
73-
from one declared within an anonymous namespace.
74-
*/
75-
bool includeAnonymous = true;
76-
77-
/** The level of concurrency desired.
78-
79-
This will always be greater than zero.
71+
/** `true` if output should consist of multiple files.
8072
*/
81-
unsigned int concurrency = 0;
73+
bool multiPage = false;
8274

8375
//--------------------------------------------
8476

lib/Lib/AbsoluteCompilationDatabase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ AbsoluteCompilationDatabase(
201201
cmd.Output = cmd0.Output;
202202
cmd.CommandLine = adjustCommandLine(
203203
cmd0.CommandLine,
204-
(*config_impl)->additionalDefines);
204+
(*config_impl)->defines);
205205

206206
if(path::is_absolute(cmd0.Directory))
207207
{

lib/Lib/ConfigImpl.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,12 @@ struct llvm::yaml::MappingTraits<
4646
static void mapping(IO& io,
4747
clang::mrdox::ConfigImpl::SettingsImpl& cfg)
4848
{
49+
io.mapOptional("concurrency", cfg.concurrency);
50+
io.mapOptional("defines", cfg.defines);
4951
io.mapOptional("ignore-failures", cfg.ignoreFailures);
52+
io.mapOptional("include-anonymous", cfg.includeAnonymous);
53+
io.mapOptional("include-private", cfg.includePrivate);
5054
io.mapOptional("multipage", cfg.multiPage);
51-
io.mapOptional("with-private", cfg.includePrivate);
52-
io.mapOptional("with-anonymous", cfg.includeAnonymous);
53-
io.mapOptional("concurrency", cfg.concurrency);
54-
55-
io.mapOptional("defines", cfg.additionalDefines);
5655
io.mapOptional("source-root", cfg.sourceRoot);
5756

5857
io.mapOptional("input", cfg.input);

lib/Lib/ConfigImpl.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,17 @@ class ConfigImpl
3535
std::vector<std::string> include;
3636
};
3737

38-
std::vector<std::string> additionalDefines;
38+
/** Additional defines passed to the compiler.
39+
*/
40+
std::vector<std::string> defines;
41+
42+
/** `true` if AST visitation failures should not stop the program.
43+
44+
@code
45+
ignore-failures: true
46+
@endcode
47+
*/
48+
bool ignoreFailures = false;
3949

4050
/** The full path to the source root directory.
4151

lib/Lib/CorpusImpl.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ mrdox::Expected<std::unique_ptr<Corpus>>
9999
CorpusImpl::
100100
build(
101101
ToolExecutor& ex,
102-
std::shared_ptr<Config const> config_)
102+
std::shared_ptr<ConfigImpl const> config)
103103
{
104-
auto config = std::dynamic_pointer_cast<ConfigImpl const>(config_);
105104
auto corpus = std::make_unique<CorpusImpl>(config);
106105

107106
// Traverse the AST for all translation units
@@ -112,7 +111,7 @@ build(
112111
makeFrontendActionFactory(
113112
*ex.getExecutionContext(), *config))))
114113
{
115-
if(! corpus->config->ignoreFailures)
114+
if(! (*config)->ignoreFailures)
116115
return err;
117116
report::warn(
118117
"Warning: mapping failed because ", err);

lib/Lib/CorpusImpl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class CorpusImpl : public Corpus
5555
mrdox::Expected<std::unique_ptr<Corpus>>
5656
build(
5757
ToolExecutor& ex,
58-
std::shared_ptr<Config const> config);
58+
std::shared_ptr<ConfigImpl const> config);
5959

6060
private:
6161
std::vector<Info const*> const&

0 commit comments

Comments
 (0)