17
17
#include < mrdox/Config.hpp>
18
18
#include < mrdox/Generators.hpp>
19
19
#include < mrdox/Support/Report.hpp>
20
+ #include < mrdox/Support/Thread.hpp>
20
21
#include < clang/Tooling/StandaloneExecution.h>
21
22
#include < llvm/Support/CommandLine.h>
22
23
#include < llvm/Support/FileSystem.h>
@@ -73,10 +74,9 @@ struct Results
73
74
74
75
class TestRunner
75
76
{
77
+ ThreadPool threadPool_;
76
78
Results& results_;
77
79
std::string extraYaml_;
78
- std::shared_ptr<Config const > config_;
79
- Config::WorkGroup wg_;
80
80
llvm::ErrorOr<std::string> diff_;
81
81
Generator const * xmlGen_;
82
82
Generator const * adocGen_;
@@ -120,17 +120,9 @@ TestRunner::
120
120
TestRunner (
121
121
Results& results,
122
122
llvm::StringRef extraYaml)
123
- : results_(results)
123
+ : threadPool_(1 )
124
+ , results_(results)
124
125
, extraYaml_(extraYaml)
125
- , config_([&extraYaml]
126
- {
127
- std::error_code ec;
128
- auto config = loadConfigString (
129
- " " , extraYaml.str ());
130
- Assert (config);
131
- return *config;
132
- }())
133
- , wg_(config_.get())
134
126
, diff_(llvm::sys::findProgramByName(" diff" ))
135
127
, xmlGen_(getGenerators().find(" xml" ))
136
128
, adocGen_(getGenerators().find(" adoc" ))
@@ -342,7 +334,7 @@ handleDir(
342
334
iter->type () == fs::file_type::regular_file &&
343
335
path::extension (iter->path ()).equals_insensitive (" .cpp" ))
344
336
{
345
- wg_ .post (
337
+ threadPool_ .post (
346
338
[this , config, filePath = SmallString (iter->path ())]
347
339
{
348
340
handleFile (filePath, config).operator bool ();
@@ -388,7 +380,7 @@ checkPath(
388
380
389
381
auto config = makeConfig (workingDir);
390
382
auto err = handleFile (inputPath, config);
391
- wg_ .wait ();
383
+ threadPool_ .wait ();
392
384
return err;
393
385
}
394
386
@@ -398,7 +390,7 @@ checkPath(
398
390
SmallString dirPath (inputPath);
399
391
path::remove_dots (dirPath, true );
400
392
auto err = handleDir (dirPath);
401
- wg_ .wait ();
393
+ threadPool_ .wait ();
402
394
return err;
403
395
}
404
396
0 commit comments