mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-10 19:39:52 -05:00
cmQtAutoMocUic: Remove now-unnecessary mutex around CollapseFullPath
KWSys's `CollapseFullPath` no longer maintains global state. The mutual exclusion added by commit51676cf655(Autogen: Split JobEvalCacheT job into separate moc and uic jobs, 2019-09-12, v3.16.0-rc1~94^2~7) and commit53d523f2e1(autogen: fix race in depfile parsing, 2021-04-15, v3.20.2~10^2) is no longer needed.
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <mutex>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@@ -561,7 +560,6 @@ public:
|
|||||||
std::string AbsoluteIncludePath(cm::string_view relativePath) const;
|
std::string AbsoluteIncludePath(cm::string_view relativePath) const;
|
||||||
template <class JOBTYPE>
|
template <class JOBTYPE>
|
||||||
void CreateParseJobs(SourceFileMapT const& sourceMap);
|
void CreateParseJobs(SourceFileMapT const& sourceMap);
|
||||||
std::string CollapseFullPathTS(std::string const& path) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// -- Abstract processing interface
|
// -- Abstract processing interface
|
||||||
@@ -595,8 +593,6 @@ private:
|
|||||||
// -- Worker thread pool
|
// -- Worker thread pool
|
||||||
std::atomic<bool> JobError_{ false };
|
std::atomic<bool> JobError_{ false };
|
||||||
cmWorkerPool WorkerPool_;
|
cmWorkerPool WorkerPool_;
|
||||||
// -- Concurrent processing
|
|
||||||
mutable std::mutex CMakeLibMutex_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
cmQtAutoMocUicT::IncludeKeyT::IncludeKeyT(std::string const& key,
|
cmQtAutoMocUicT::IncludeKeyT::IncludeKeyT(std::string const& key,
|
||||||
@@ -1494,8 +1490,9 @@ bool cmQtAutoMocUicT::JobEvalCacheMocT::FindIncludedHeader(
|
|||||||
&headerHandle](std::string const& basePath) -> bool {
|
&headerHandle](std::string const& basePath) -> bool {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (std::string const& ext : this->BaseConst().HeaderExtensions) {
|
for (std::string const& ext : this->BaseConst().HeaderExtensions) {
|
||||||
std::string const testPath =
|
std::string const testPath = cmSystemTools::CollapseFullPath(
|
||||||
this->Gen()->CollapseFullPathTS(cmStrCat(basePath, '.', ext));
|
cmStrCat(basePath, '.', ext),
|
||||||
|
this->Gen()->ProjectDirs().CurrentSource);
|
||||||
cmFileTime fileTime;
|
cmFileTime fileTime;
|
||||||
if (!fileTime.Load(testPath)) {
|
if (!fileTime.Load(testPath)) {
|
||||||
// File not found
|
// File not found
|
||||||
@@ -1682,7 +1679,8 @@ bool cmQtAutoMocUicT::JobEvalCacheUicT::FindIncludedUi(
|
|||||||
this->SearchLocations.clear();
|
this->SearchLocations.clear();
|
||||||
|
|
||||||
auto findUi = [this](std::string const& testPath) -> bool {
|
auto findUi = [this](std::string const& testPath) -> bool {
|
||||||
std::string const fullPath = this->Gen()->CollapseFullPathTS(testPath);
|
std::string const fullPath = cmSystemTools::CollapseFullPath(
|
||||||
|
testPath, this->Gen()->ProjectDirs().CurrentSource);
|
||||||
cmFileTime fileTime;
|
cmFileTime fileTime;
|
||||||
if (!fileTime.Load(fullPath)) {
|
if (!fileTime.Load(fullPath)) {
|
||||||
this->SearchLocations.emplace_back(cmQtAutoGen::ParentDir(fullPath));
|
this->SearchLocations.emplace_back(cmQtAutoGen::ParentDir(fullPath));
|
||||||
@@ -2885,17 +2883,6 @@ void cmQtAutoMocUicT::CreateParseJobs(SourceFileMapT const& sourceMap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Concurrently callable implementation of cmSystemTools::CollapseFullPath */
|
|
||||||
std::string cmQtAutoMocUicT::CollapseFullPathTS(std::string const& path) const
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> guard(this->CMakeLibMutex_);
|
|
||||||
#if defined(__NVCOMPILER) || defined(__LCC__)
|
|
||||||
static_cast<void>(guard); // convince compiler var is used
|
|
||||||
#endif
|
|
||||||
return cmSystemTools::CollapseFullPath(path,
|
|
||||||
this->ProjectDirs().CurrentSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmQtAutoMocUicT::InitJobs()
|
void cmQtAutoMocUicT::InitJobs()
|
||||||
{
|
{
|
||||||
// Add moc_predefs.h job
|
// Add moc_predefs.h job
|
||||||
@@ -3130,10 +3117,6 @@ bool cmQtAutoMocUicT::CreateDirectories()
|
|||||||
std::vector<std::string> cmQtAutoMocUicT::dependenciesFromDepFile(
|
std::vector<std::string> cmQtAutoMocUicT::dependenciesFromDepFile(
|
||||||
const char* filePath)
|
const char* filePath)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(this->CMakeLibMutex_);
|
|
||||||
#if defined(__NVCOMPILER) || defined(__LCC__)
|
|
||||||
static_cast<void>(guard); // convince compiler var is used
|
|
||||||
#endif
|
|
||||||
auto const content = cmReadGccDepfile(filePath);
|
auto const content = cmReadGccDepfile(filePath);
|
||||||
if (!content || content->empty()) {
|
if (!content || content->empty()) {
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
Reference in New Issue
Block a user