Rename cmFileTimeComparison to cmFileTimeCache

The name `cmFileTimeCache` reflects the functionality of the class more
appropriately.
This commit is contained in:
Sebastian Holtermann 2019-03-13 19:10:19 +01:00
parent 3160258393
commit 216416219a
11 changed files with 37 additions and 41 deletions

View File

@ -238,8 +238,8 @@ set(SRCS
cmFilePathChecksum.h cmFilePathChecksum.h
cmFileTime.cxx cmFileTime.cxx
cmFileTime.h cmFileTime.h
cmFileTimeComparison.cxx cmFileTimeCache.cxx
cmFileTimeComparison.h cmFileTimeCache.h
cmFortranParserImpl.cxx cmFortranParserImpl.cxx
cmFSPermissions.cxx cmFSPermissions.cxx
cmFSPermissions.h cmFSPermissions.h

View File

@ -5,7 +5,7 @@
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
#include "cmCTest.h" #include "cmCTest.h"
#include "cmDuration.h" #include "cmDuration.h"
#include "cmFileTimeComparison.h" #include "cmFileTimeCache.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmProcessOutput.h" #include "cmProcessOutput.h"
@ -503,7 +503,7 @@ void cmCTestBuildHandler::GenerateXMLHeader(cmXMLWriter& xml)
class cmCTestBuildHandler::FragmentCompare class cmCTestBuildHandler::FragmentCompare
{ {
public: public:
FragmentCompare(cmFileTimeComparison* ftc) FragmentCompare(cmFileTimeCache* ftc)
: FTC(ftc) : FTC(ftc)
{ {
} }
@ -520,7 +520,7 @@ public:
} }
private: private:
cmFileTimeComparison* FTC = nullptr; cmFileTimeCache* FTC = nullptr;
}; };
void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml) void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml)
@ -530,7 +530,7 @@ void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml)
} }
// Sort XML fragments in chronological order. // Sort XML fragments in chronological order.
cmFileTimeComparison ftc; cmFileTimeCache ftc;
FragmentCompare fragmentCompare(&ftc); FragmentCompare fragmentCompare(&ftc);
typedef std::set<std::string, FragmentCompare> Fragments; typedef std::set<std::string, FragmentCompare> Fragments;
Fragments fragments(fragmentCompare); Fragments fragments(fragmentCompare);

View File

@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */ file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmDepends.h" #include "cmDepends.h"
#include "cmFileTimeComparison.h" #include "cmFileTimeCache.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
#include "cmMakefile.h" #include "cmMakefile.h"

View File

@ -12,7 +12,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
class cmFileTimeComparison; class cmFileTimeCache;
class cmLocalGenerator; class cmLocalGenerator;
/** \class cmDepends /** \class cmDepends
@ -72,10 +72,7 @@ public:
void Clear(const std::string& file); void Clear(const std::string& file);
/** Set the file comparison object */ /** Set the file comparison object */
void SetFileComparison(cmFileTimeComparison* fc) void SetFileComparison(cmFileTimeCache* fc) { this->FileComparison = fc; }
{
this->FileComparison = fc;
}
protected: protected:
// Write dependencies for the target file to the given stream. // Write dependencies for the target file to the given stream.
@ -101,7 +98,7 @@ protected:
// Flag for verbose output. // Flag for verbose output.
bool Verbose = false; bool Verbose = false;
cmFileTimeComparison* FileComparison = nullptr; cmFileTimeCache* FileComparison = nullptr;
std::string Language; std::string Language;

View File

@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep #include "cmConfigure.h" // IWYU pragma: keep
#include "cmFileTimeComparison.h" #include "cmFileTimeCache.h"
#include "cm_sys_stat.h" #include "cm_sys_stat.h"
#include "cmsys/RegularExpression.hxx" #include "cmsys/RegularExpression.hxx"
@ -28,7 +28,7 @@ protected:
cmMakefile* Makefile; cmMakefile* Makefile;
const char* Name; const char* Name;
bool Always; bool Always;
cmFileTimeComparison FileTimes; cmFileTimeCache FileTimes;
// Whether to install a file not matching any expression. // Whether to install a file not matching any expression.
bool MatchlessFiles; bool MatchlessFiles;

View File

@ -1,17 +1,16 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */ file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFileTimeComparison.h" #include "cmFileTimeCache.h"
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
cmFileTimeComparison::cmFileTimeComparison() = default; cmFileTimeCache::cmFileTimeCache() = default;
cmFileTimeComparison::~cmFileTimeComparison() = default; cmFileTimeCache::~cmFileTimeCache() = default;
bool cmFileTimeComparison::Load(std::string const& fileName, bool cmFileTimeCache::Load(std::string const& fileName, cmFileTime& fileTime)
cmFileTime& fileTime)
{ {
// Use the stored time if available. // Use the stored time if available.
{ {
@ -30,8 +29,8 @@ bool cmFileTimeComparison::Load(std::string const& fileName,
return true; return true;
} }
bool cmFileTimeComparison::FileTimeCompare(std::string const& f1, bool cmFileTimeCache::FileTimeCompare(std::string const& f1,
std::string const& f2, int* result) std::string const& f2, int* result)
{ {
// Get the modification time for each file. // Get the modification time for each file.
cmFileTime ft1, ft2; cmFileTime ft1, ft2;
@ -45,8 +44,8 @@ bool cmFileTimeComparison::FileTimeCompare(std::string const& f1,
return false; return false;
} }
bool cmFileTimeComparison::FileTimesDiffer(std::string const& f1, bool cmFileTimeCache::FileTimesDiffer(std::string const& f1,
std::string const& f2) std::string const& f2)
{ {
// Get the modification time for each file. // Get the modification time for each file.
cmFileTime ft1, ft2; cmFileTime ft1, ft2;

View File

@ -1,7 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */ file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmFileTimeComparison_h #ifndef cmFileTimeCache_h
#define cmFileTimeComparison_h #define cmFileTimeCache_h
#include "cmConfigure.h" // IWYU pragma: keep #include "cmConfigure.h" // IWYU pragma: keep
@ -9,17 +9,17 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
/** \class cmFileTimeComparison /** \class cmFileTimeCache
* \brief Caches file modification times in an internal map for fast lookups. * \brief Caches file modification times in an internal map for fast lookups.
*/ */
class cmFileTimeComparison class cmFileTimeCache
{ {
public: public:
cmFileTimeComparison(); cmFileTimeCache();
~cmFileTimeComparison(); ~cmFileTimeCache();
cmFileTimeComparison(const cmFileTimeComparison&) = delete; cmFileTimeCache(const cmFileTimeCache&) = delete;
cmFileTimeComparison& operator=(const cmFileTimeComparison&) = delete; cmFileTimeCache& operator=(const cmFileTimeCache&) = delete;
/** /**
* @brief Loads the file time from the cache or the file system. * @brief Loads the file time from the cache or the file system.

View File

@ -12,7 +12,7 @@
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
#include "cmCustomCommandGenerator.h" #include "cmCustomCommandGenerator.h"
#include "cmFileTimeComparison.h" #include "cmFileTimeCache.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h" #include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
@ -1273,7 +1273,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
// happen when a new source file is added and CMake regenerates the // happen when a new source file is added and CMake regenerates the
// project but no other sources were touched. // project but no other sources were touched.
bool needRescanDependInfo = false; bool needRescanDependInfo = false;
cmFileTimeComparison* ftc = cmFileTimeCache* ftc =
this->GlobalGenerator->GetCMakeInstance()->GetFileComparison(); this->GlobalGenerator->GetCMakeInstance()->GetFileComparison();
{ {
int result; int result;

View File

@ -9,7 +9,7 @@
#include "cmDocumentationFormatter.h" #include "cmDocumentationFormatter.h"
#include "cmDuration.h" #include "cmDuration.h"
#include "cmExternalMakefileProjectGenerator.h" #include "cmExternalMakefileProjectGenerator.h"
#include "cmFileTimeComparison.h" #include "cmFileTimeCache.h"
#include "cmGeneratorTarget.h" #include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmGlobalGeneratorFactory.h" #include "cmGlobalGeneratorFactory.h"
@ -138,7 +138,7 @@ cmake::cmake(Role role, cmState::Mode mode)
this->DebugOutput = false; this->DebugOutput = false;
this->DebugTryCompile = false; this->DebugTryCompile = false;
this->ClearBuildSystem = false; this->ClearBuildSystem = false;
this->FileComparison = new cmFileTimeComparison; this->FileComparison = new cmFileTimeCache;
this->State = new cmState; this->State = new cmState;
this->State->SetMode(mode); this->State->SetMode(mode);
@ -2431,7 +2431,7 @@ static bool cmakeCheckStampFile(const std::string& stampName)
} }
// Compare the stamp dependencies against the dependency file itself. // Compare the stamp dependencies against the dependency file itself.
cmFileTimeComparison ftc; cmFileTimeCache ftc;
std::string dep; std::string dep;
while (cmSystemTools::GetLineFromStream(fin, dep)) { while (cmSystemTools::GetLineFromStream(fin, dep)) {
int result; int result;

View File

@ -26,7 +26,7 @@
class cmExternalMakefileProjectGeneratorFactory; class cmExternalMakefileProjectGeneratorFactory;
class cmFileAPI; class cmFileAPI;
class cmFileTimeComparison; class cmFileTimeCache;
class cmGlobalGenerator; class cmGlobalGenerator;
class cmGlobalGeneratorFactory; class cmGlobalGeneratorFactory;
class cmMakefile; class cmMakefile;
@ -329,7 +329,7 @@ public:
/** /**
* Get the file comparison class * Get the file comparison class
*/ */
cmFileTimeComparison* GetFileComparison() { return this->FileComparison; } cmFileTimeCache* GetFileComparison() { return this->FileComparison; }
// Do we want debug output during the cmake run. // Do we want debug output during the cmake run.
bool GetDebugOutput() { return this->DebugOutput; } bool GetDebugOutput() { return this->DebugOutput; }
@ -509,7 +509,7 @@ private:
std::unordered_set<std::string> HeaderFileExtensionsSet; std::unordered_set<std::string> HeaderFileExtensionsSet;
bool ClearBuildSystem; bool ClearBuildSystem;
bool DebugTryCompile; bool DebugTryCompile;
cmFileTimeComparison* FileComparison; cmFileTimeCache* FileComparison;
std::string GraphVizFile; std::string GraphVizFile;
InstalledFilesMap InstalledFiles; InstalledFilesMap InstalledFiles;

View File

@ -305,7 +305,7 @@ CMAKE_CXX_SOURCES="\
cmFileCopier \ cmFileCopier \
cmFileInstaller \ cmFileInstaller \
cmFileTime \ cmFileTime \
cmFileTimeComparison \ cmFileTimeCache \
cmFindBase \ cmFindBase \
cmFindCommon \ cmFindCommon \
cmFindFileCommand \ cmFindFileCommand \