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
cmFileTime.cxx
cmFileTime.h
cmFileTimeComparison.cxx
cmFileTimeComparison.h
cmFileTimeCache.cxx
cmFileTimeCache.h
cmFortranParserImpl.cxx
cmFSPermissions.cxx
cmFSPermissions.h

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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