diff options
-rw-r--r-- | Source/cmQtAutoMocUic.cxx | 54 | ||||
-rw-r--r-- | Source/cmQtAutoMocUic.h | 110 |
2 files changed, 57 insertions, 107 deletions
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index c305ca6..fe63dec 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -551,7 +551,7 @@ void cmQtAutoMocUic::JobParseSourceT::Process() } } -void cmQtAutoMocUic::JobEvaluateT::Process() +void cmQtAutoMocUic::JobEvalCacheT::Process() { // Evaluate for moc if (MocConst().Enabled) { @@ -578,10 +578,10 @@ void cmQtAutoMocUic::JobEvaluateT::Process() // Add discovered header parse jobs Gen()->CreateParseJobs<JobParseHeaderT>(MocEval().HeadersDiscovered); // Add generate job after - Gen()->WorkerPool().EmplaceJob<JobGenerateT>(); + Gen()->WorkerPool().EmplaceJob<JobProbeDepsT>(); } -bool cmQtAutoMocUic::JobEvaluateT::MocEvalHeader(SourceFileHandleT source) +bool cmQtAutoMocUic::JobEvalCacheT::MocEvalHeader(SourceFileHandleT source) { SourceFileT const& sourceFile = *source; auto const& parseData = sourceFile.ParseData->Moc; @@ -608,7 +608,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalHeader(SourceFileHandleT source) return true; } -bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource( +bool cmQtAutoMocUic::JobEvalCacheT::MocEvalSource( SourceFileHandleT const& source) { SourceFileT const& sourceFile = *source; @@ -799,7 +799,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource( } cmQtAutoMocUic::SourceFileHandleT -cmQtAutoMocUic::JobEvaluateT::MocFindIncludedHeader( +cmQtAutoMocUic::JobEvalCacheT::MocFindIncludedHeader( std::string const& includerDir, std::string const& includeBase) const { // Search in vicinity of the source @@ -821,7 +821,7 @@ cmQtAutoMocUic::JobEvaluateT::MocFindIncludedHeader( return SourceFileHandleT(); } -cmQtAutoMocUic::SourceFileHandleT cmQtAutoMocUic::JobEvaluateT::MocFindHeader( +cmQtAutoMocUic::SourceFileHandleT cmQtAutoMocUic::JobEvalCacheT::MocFindHeader( std::string const& basePath) const { std::string testPath; @@ -857,7 +857,7 @@ cmQtAutoMocUic::SourceFileHandleT cmQtAutoMocUic::JobEvaluateT::MocFindHeader( return SourceFileHandleT(); } -std::string cmQtAutoMocUic::JobEvaluateT::MocMessageTestHeaders( +std::string cmQtAutoMocUic::JobEvalCacheT::MocMessageTestHeaders( cm::string_view fileBase) const { std::string const exts = @@ -870,7 +870,7 @@ std::string cmQtAutoMocUic::JobEvaluateT::MocMessageTestHeaders( return res; } -bool cmQtAutoMocUic::JobEvaluateT::MocRegisterIncluded( +bool cmQtAutoMocUic::JobEvalCacheT::MocRegisterIncluded( std::string const& includeString, SourceFileHandleT includerFileHandle, SourceFileHandleT sourceFileHandle, bool sourceIsHeader) const { @@ -917,7 +917,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocRegisterIncluded( return true; } -void cmQtAutoMocUic::JobEvaluateT::MocRegisterMapping( +void cmQtAutoMocUic::JobEvalCacheT::MocRegisterMapping( MappingHandleT mappingHandle, bool sourceIsHeader) const { auto& regMap = @@ -935,7 +935,7 @@ void cmQtAutoMocUic::JobEvaluateT::MocRegisterMapping( } } -bool cmQtAutoMocUic::JobEvaluateT::UicEval(SourceFileMapT const& fileMap) +bool cmQtAutoMocUic::JobEvalCacheT::UicEval(SourceFileMapT const& fileMap) { for (auto const& pair : fileMap) { if (!UicEvalFile(pair.second)) { @@ -945,7 +945,7 @@ bool cmQtAutoMocUic::JobEvaluateT::UicEval(SourceFileMapT const& fileMap) return true; } -bool cmQtAutoMocUic::JobEvaluateT::UicEvalFile( +bool cmQtAutoMocUic::JobEvalCacheT::UicEvalFile( SourceFileHandleT const& sourceFileHandle) { SourceFileT const& sourceFile = *sourceFileHandle; @@ -972,7 +972,7 @@ bool cmQtAutoMocUic::JobEvaluateT::UicEvalFile( return true; } -bool cmQtAutoMocUic::JobEvaluateT::UicRegisterMapping( +bool cmQtAutoMocUic::JobEvalCacheT::UicRegisterMapping( std::string const& includeString, SourceFileHandleT uiFileHandle, SourceFileHandleT includerFileHandle) { @@ -1019,7 +1019,7 @@ bool cmQtAutoMocUic::JobEvaluateT::UicRegisterMapping( } cmQtAutoMocUic::SourceFileHandleT -cmQtAutoMocUic::JobEvaluateT::UicFindIncludedUi( +cmQtAutoMocUic::JobEvalCacheT::UicFindIncludedUi( std::string const& sourceFile, std::string const& sourceDir, IncludeKeyT const& incKey) const { @@ -1083,7 +1083,7 @@ cmQtAutoMocUic::JobEvaluateT::UicFindIncludedUi( return SourceFileHandleT(); } -void cmQtAutoMocUic::JobGenerateT::Process() +void cmQtAutoMocUic::JobProbeDepsT::Process() { // Add moc compile jobs if (MocConst().Enabled) { @@ -1120,8 +1120,8 @@ void cmQtAutoMocUic::JobGenerateT::Process() Gen()->WorkerPool().EmplaceJob<JobFinishT>(); } -bool cmQtAutoMocUic::JobGenerateT::MocGenerate(MappingHandleT const& mapping, - bool compFile) const +bool cmQtAutoMocUic::JobProbeDepsT::MocGenerate(MappingHandleT const& mapping, + bool compFile) const { std::unique_ptr<std::string> reason; if (Log().Verbose()) { @@ -1135,7 +1135,7 @@ bool cmQtAutoMocUic::JobGenerateT::MocGenerate(MappingHandleT const& mapping, return false; } // Add moc job - Gen()->WorkerPool().EmplaceJob<JobMocT>(mapping, std::move(reason)); + Gen()->WorkerPool().EmplaceJob<JobCompileMocT>(mapping, std::move(reason)); // Check if a moc job for a mocs_compilation.cpp entry was generated if (compFile) { MocEval().CompUpdated = true; @@ -1144,8 +1144,8 @@ bool cmQtAutoMocUic::JobGenerateT::MocGenerate(MappingHandleT const& mapping, return true; } -bool cmQtAutoMocUic::JobGenerateT::MocUpdate(MappingT const& mapping, - std::string* reason) const +bool cmQtAutoMocUic::JobProbeDepsT::MocUpdate(MappingT const& mapping, + std::string* reason) const { std::string const& sourceFile = mapping.SourceFile->FileName; std::string const& outputFile = mapping.OutputFile; @@ -1232,7 +1232,7 @@ bool cmQtAutoMocUic::JobGenerateT::MocUpdate(MappingT const& mapping, } std::pair<std::string, cmFileTime> -cmQtAutoMocUic::JobGenerateT::MocFindDependency( +cmQtAutoMocUic::JobProbeDepsT::MocFindDependency( std::string const& sourceDir, std::string const& includeString) const { using ResPair = std::pair<std::string, cmFileTime>; @@ -1254,7 +1254,7 @@ cmQtAutoMocUic::JobGenerateT::MocFindDependency( return ResPair(); } -bool cmQtAutoMocUic::JobGenerateT::UicGenerate( +bool cmQtAutoMocUic::JobProbeDepsT::UicGenerate( MappingHandleT const& mapping) const { std::unique_ptr<std::string> reason; @@ -1269,13 +1269,13 @@ bool cmQtAutoMocUic::JobGenerateT::UicGenerate( return false; } // Add uic job - Gen()->WorkerPool().EmplaceJob<JobUicT>(mapping, std::move(reason)); + Gen()->WorkerPool().EmplaceJob<JobCompileUicT>(mapping, std::move(reason)); } return true; } -bool cmQtAutoMocUic::JobGenerateT::UicUpdate(MappingT const& mapping, - std::string* reason) const +bool cmQtAutoMocUic::JobProbeDepsT::UicUpdate(MappingT const& mapping, + std::string* reason) const { std::string const& sourceFile = mapping.SourceFile->FileName; std::string const& outputFile = mapping.OutputFile; @@ -1324,7 +1324,7 @@ bool cmQtAutoMocUic::JobGenerateT::UicUpdate(MappingT const& mapping, return false; } -void cmQtAutoMocUic::JobMocT::Process() +void cmQtAutoMocUic::JobCompileMocT::Process() { std::string const& sourceFile = Mapping->SourceFile->FileName; std::string const& outputFile = Mapping->OutputFile; @@ -1368,7 +1368,7 @@ void cmQtAutoMocUic::JobMocT::Process() } } -void cmQtAutoMocUic::JobUicT::Process() +void cmQtAutoMocUic::JobCompileUicT::Process() { std::string const& sourceFile = Mapping->SourceFile->FileName; std::string const& outputFile = Mapping->OutputFile; @@ -1848,7 +1848,7 @@ void cmQtAutoMocUic::InitJobs() // Add source parse jobs CreateParseJobs<JobParseSourceT>(BaseEval().Sources); // Add evaluate job - WorkerPool().EmplaceJob<JobEvaluateT>(); + WorkerPool().EmplaceJob<JobEvalCacheT>(); } bool cmQtAutoMocUic::Process() diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h index 2f6ebff..3e815cd 100644 --- a/Source/cmQtAutoMocUic.h +++ b/Source/cmQtAutoMocUic.h @@ -40,9 +40,7 @@ public: public: // -- Types - /** - * Search key plus regular expression pair - */ + /** Search key plus regular expression pair. */ struct KeyExpT { KeyExpT() = default; @@ -63,9 +61,7 @@ public: cmsys::RegularExpression Exp; }; - /** - * Include string with sub parts - */ + /** Include string with sub parts. */ struct IncludeKeyT { IncludeKeyT(std::string const& key, std::size_t basePrefixLength); @@ -75,9 +71,7 @@ public: std::string Base; // Base part of the include file name }; - /** - * Source file parsing cache - */ + /** Source file parsing cache. */ class ParseCacheT { public: @@ -127,9 +121,7 @@ public: std::unordered_map<std::string, FileHandleT> Map_; }; - /** - * Source file data - */ + /** Source file data. */ class SourceFileT { public: @@ -149,9 +141,7 @@ public: using SourceFileHandleT = std::shared_ptr<SourceFileT>; using SourceFileMapT = std::map<std::string, SourceFileHandleT>; - /** - * Meta compiler file mapping information - */ + /** Meta compiler file mapping information. */ struct MappingT { SourceFileHandleT SourceFile; @@ -162,9 +152,7 @@ public: using MappingHandleT = std::shared_ptr<MappingT>; using MappingMapT = std::map<std::string, MappingHandleT>; - /** - * Common settings - */ + /** Common settings. */ class BaseSettingsT { public: @@ -193,9 +181,7 @@ public: std::vector<std::string> HeaderExtensions; }; - /** - * Shared common variables - */ + /** Shared common variables. */ class BaseEvalT { public: @@ -209,9 +195,7 @@ public: SourceFileMapT Sources; }; - /** - * Moc settings - */ + /** Moc settings. */ class MocSettingsT { public: @@ -247,9 +231,7 @@ public: cmsys::RegularExpression RegExpInclude; }; - /** - * Moc shared variables - */ + /** Moc shared variables. */ class MocEvalT { public: @@ -266,9 +248,7 @@ public: std::vector<std::string> CompFiles; }; - /** - * Uic settings - */ + /** Uic settings. */ class UicSettingsT { public: @@ -293,9 +273,7 @@ public: cmsys::RegularExpression RegExpInclude; }; - /** - * Uic shared variables - */ + /** Uic shared variables. */ class UicEvalT { public: @@ -303,15 +281,11 @@ public: MappingMapT Includes; }; - /** - * Abstract job class for concurrent job processing - */ + /** Abstract job class for concurrent job processing. */ class JobT : public cmWorkerPool::JobT { protected: - /** - * @brief Protected default constructor - */ + /** Protected default constructor. */ JobT(bool fence = false) : cmWorkerPool::JobT(fence) { @@ -340,17 +314,13 @@ public: std::vector<std::string> const& command, std::string const& output) const; - /** - * @brief Run an external process. Use only during Process() call! - */ + /** @brief Run an external process. Use only during Process() call! */ bool RunProcess(GenT genType, cmWorkerPool::ProcessResultT& result, std::vector<std::string> const& command, std::string* infoMessage = nullptr); }; - /** - * Fence job utility class - */ + /** Fence job utility class. */ class JobFenceT : public JobT { public: @@ -361,18 +331,14 @@ public: void Process() override{}; }; - /** - * Generate moc_predefs.h - */ + /** Generate moc_predefs.h. */ class JobMocPredefsT : public JobFenceT { void Process() override; bool Update(std::string* reason) const; }; - /** - * File parse job base class - */ + /** File parse job base class. */ class JobParseT : public JobT { public: @@ -396,9 +362,7 @@ public: std::string Content; }; - /** - * Header file parse job - */ + /** Header file parse job. */ class JobParseHeaderT : public JobParseT { public: @@ -406,9 +370,7 @@ public: void Process() override; }; - /** - * Source file parse job - */ + /** Source file parse job. */ class JobParseSourceT : public JobParseT { public: @@ -416,10 +378,8 @@ public: void Process() override; }; - /** - * Evaluate parsed files - */ - class JobEvaluateT : public JobFenceT + /** Evaluate cached file parse data. */ + class JobEvalCacheT : public JobFenceT { void Process() override; @@ -448,10 +408,8 @@ public: SourceFileHandleT includerFileHandle); }; - /** - * Generates moc/uic jobs - */ - class JobGenerateT : public JobFenceT + /** Probes file dependencies and generates moc and uic compile jobs. */ + class JobProbeDepsT : public JobFenceT { void Process() override; // -- Moc @@ -464,9 +422,7 @@ public: bool UicUpdate(MappingT const& mapping, std::string* reason) const; }; - /** - * File compiling base job - */ + /** Meta compiler base job. */ class JobCompileT : public JobT { public: @@ -481,36 +437,30 @@ public: std::unique_ptr<std::string> Reason; }; - /** - * moc compiles a file - */ - class JobMocT : public JobCompileT + /** moc compiles a file. */ + class JobCompileMocT : public JobCompileT { public: using JobCompileT::JobCompileT; void Process() override; }; - /** - * uic compiles a file - */ - class JobUicT : public JobCompileT + /** uic compiles a file. */ + class JobCompileUicT : public JobCompileT { public: using JobCompileT::JobCompileT; void Process() override; }; - /// @brief Generate mocs_compilation.cpp - /// + /** Generate mocs_compilation.cpp. */ class JobMocsCompilationT : public JobFenceT { private: void Process() override; }; - /// @brief The last job - /// + /** @brief The last job. */ class JobFinishT : public JobFenceT { private: |