Преглед изворни кода

Merge topic 'file-api-version-int-vars'

892fa0bb88 fileapi: Use unsigned int consistently for version numbers

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !10945
Brad King пре 4 месеци
родитељ
комит
e82da297d4

+ 3 - 3
Source/cmConfigureLog.cxx

@@ -23,12 +23,12 @@
 #include "cmake.h"
 
 cmConfigureLog::cmConfigureLog(std::string logDir,
-                               std::vector<unsigned long> logVersions)
+                               std::vector<unsigned int> logVersions)
   : LogDir(std::move(logDir))
   , LogVersions(std::move(logVersions))
 {
   // Always emit events for the latest log version.
-  static unsigned long const LatestLogVersion = 1;
+  static unsigned int const LatestLogVersion = 1;
   if (!cm::contains(this->LogVersions, LatestLogVersion)) {
     this->LogVersions.emplace_back(LatestLogVersion);
   }
@@ -46,7 +46,7 @@ cmConfigureLog::~cmConfigureLog()
 }
 
 bool cmConfigureLog::IsAnyLogVersionEnabled(
-  std::vector<unsigned long> const& v) const
+  std::vector<unsigned int> const& v) const
 {
   // Both input lists are sorted.  Look for a matching element.
   auto i1 = v.cbegin();

+ 3 - 3
Source/cmConfigureLog.h

@@ -22,12 +22,12 @@ class cmConfigureLog
 public:
   /** Construct with the log directory and a sorted list of enabled log
       versions.  The latest log version will be enabled regardless.  */
-  cmConfigureLog(std::string logDir, std::vector<unsigned long> logVersions);
+  cmConfigureLog(std::string logDir, std::vector<unsigned int> logVersions);
   ~cmConfigureLog();
 
   /** Return true if at least one of the log versions in the given sorted
       list is enabled.  */
-  bool IsAnyLogVersionEnabled(std::vector<unsigned long> const& v) const;
+  bool IsAnyLogVersionEnabled(std::vector<unsigned int> const& v) const;
 
   void EnsureInit();
 
@@ -60,7 +60,7 @@ public:
 
 private:
   std::string LogDir;
-  std::vector<unsigned long> LogVersions;
+  std::vector<unsigned int> LogVersions;
   cmsys::ofstream Stream;
   unsigned Indent = 0;
   bool Opened = false;

+ 3 - 3
Source/cmFileAPI.cxx

@@ -85,9 +85,9 @@ void cmFileAPI::ReadQueries()
   }
 }
 
-std::vector<unsigned long> cmFileAPI::GetConfigureLogVersions()
+std::vector<unsigned int> cmFileAPI::GetConfigureLogVersions()
 {
-  std::vector<unsigned long> versions;
+  std::vector<unsigned int> versions;
   auto getConfigureLogVersions = [&versions](Query const& q) {
     for (Object const& o : q.Known) {
       if (o.Kind == ObjectKind::ConfigureLog) {
@@ -126,7 +126,7 @@ std::vector<std::string> cmFileAPI::LoadDir(std::string const& dir)
   std::vector<std::string> files;
   cmsys::Directory d;
   d.Load(dir);
-  for (unsigned long i = 0; i < d.GetNumberOfFiles(); ++i) {
+  for (unsigned int i = 0; i < d.GetNumberOfFiles(); ++i) {
     std::string f = d.GetFile(i);
     if (f != "." && f != "..") {
       files.push_back(std::move(f));

+ 2 - 2
Source/cmFileAPI.h

@@ -25,7 +25,7 @@ public:
   void ReadQueries();
 
   /** Get the list of configureLog object kind versions requested.  */
-  std::vector<unsigned long> GetConfigureLogVersions();
+  std::vector<unsigned int> GetConfigureLogVersions();
 
   /** Identify the situation in which WriteReplies is called.  */
   enum class IndexFor
@@ -83,7 +83,7 @@ private:
   struct Object
   {
     ObjectKind Kind;
-    unsigned long Version = 0;
+    unsigned int Version = 0;
     friend bool operator<(Object const& l, Object const& r)
     {
       if (l.Kind != r.Kind) {

+ 4 - 4
Source/cmFileAPICMakeFiles.cxx

@@ -22,7 +22,7 @@ namespace {
 class CMakeFiles
 {
   cmFileAPI& FileAPI;
-  unsigned long Version;
+  unsigned int Version;
   std::string CMakeModules;
   std::string const& TopSource;
   std::string const& TopBuild;
@@ -35,11 +35,11 @@ class CMakeFiles
   Json::Value DumpGlobDependent(cmGlobCacheEntry const& entry);
 
 public:
-  CMakeFiles(cmFileAPI& fileAPI, unsigned long version);
+  CMakeFiles(cmFileAPI& fileAPI, unsigned int version);
   Json::Value Dump();
 };
 
-CMakeFiles::CMakeFiles(cmFileAPI& fileAPI, unsigned long version)
+CMakeFiles::CMakeFiles(cmFileAPI& fileAPI, unsigned int version)
   : FileAPI(fileAPI)
   , Version(version)
   , CMakeModules(cmSystemTools::GetCMakeRoot() + "/Modules")
@@ -150,7 +150,7 @@ Json::Value CMakeFiles::DumpGlobDependent(cmGlobCacheEntry const& entry)
 }
 }
 
-Json::Value cmFileAPICMakeFilesDump(cmFileAPI& fileAPI, unsigned long version)
+Json::Value cmFileAPICMakeFilesDump(cmFileAPI& fileAPI, unsigned int version)
 {
   CMakeFiles cmakeFiles(fileAPI, version);
   return cmakeFiles.Dump();

+ 1 - 1
Source/cmFileAPICMakeFiles.h

@@ -9,4 +9,4 @@
 class cmFileAPI;
 
 extern Json::Value cmFileAPICMakeFilesDump(cmFileAPI& fileAPI,
-                                           unsigned long version);
+                                           unsigned int version);

+ 4 - 4
Source/cmFileAPICache.cxx

@@ -19,7 +19,7 @@ namespace {
 class Cache
 {
   cmFileAPI& FileAPI;
-  unsigned long Version;
+  unsigned int Version;
   cmState* State;
 
   Json::Value DumpEntries();
@@ -29,11 +29,11 @@ class Cache
                                 std::string const& prop);
 
 public:
-  Cache(cmFileAPI& fileAPI, unsigned long version);
+  Cache(cmFileAPI& fileAPI, unsigned int version);
   Json::Value Dump();
 };
 
-Cache::Cache(cmFileAPI& fileAPI, unsigned long version)
+Cache::Cache(cmFileAPI& fileAPI, unsigned int version)
   : FileAPI(fileAPI)
   , Version(version)
   , State(this->FileAPI.GetCMakeInstance()->GetState())
@@ -101,7 +101,7 @@ Json::Value Cache::DumpEntryProperty(std::string const& name,
 }
 }
 
-Json::Value cmFileAPICacheDump(cmFileAPI& fileAPI, unsigned long version)
+Json::Value cmFileAPICacheDump(cmFileAPI& fileAPI, unsigned int version)
 {
   Cache cache(fileAPI, version);
   return cache.Dump();

+ 1 - 1
Source/cmFileAPICache.h

@@ -9,4 +9,4 @@
 class cmFileAPI;
 
 extern Json::Value cmFileAPICacheDump(cmFileAPI& fileAPI,
-                                      unsigned long version);
+                                      unsigned int version);

+ 7 - 7
Source/cmFileAPICodemodel.cxx

@@ -223,21 +223,21 @@ Json::Value BacktraceData::Dump()
 class Codemodel
 {
   cmFileAPI& FileAPI;
-  unsigned long Version;
+  unsigned int Version;
 
   Json::Value DumpPaths();
   Json::Value DumpConfigurations();
   Json::Value DumpConfiguration(std::string const& config);
 
 public:
-  Codemodel(cmFileAPI& fileAPI, unsigned long version);
+  Codemodel(cmFileAPI& fileAPI, unsigned int version);
   Json::Value Dump();
 };
 
 class CodemodelConfig
 {
   cmFileAPI& FileAPI;
-  unsigned long Version;
+  unsigned int Version;
   std::string const& Config;
   std::string TopSource;
   std::string TopBuild;
@@ -290,7 +290,7 @@ class CodemodelConfig
   Json::Value DumpMinimumCMakeVersion(cmStateSnapshot s);
 
 public:
-  CodemodelConfig(cmFileAPI& fileAPI, unsigned long version,
+  CodemodelConfig(cmFileAPI& fileAPI, unsigned int version,
                   std::string const& config);
   Json::Value Dump();
 };
@@ -515,7 +515,7 @@ public:
   Json::Value Dump();
 };
 
-Codemodel::Codemodel(cmFileAPI& fileAPI, unsigned long version)
+Codemodel::Codemodel(cmFileAPI& fileAPI, unsigned int version)
   : FileAPI(fileAPI)
   , Version(version)
 {
@@ -561,7 +561,7 @@ Json::Value Codemodel::DumpConfiguration(std::string const& config)
   return configuration.Dump();
 }
 
-CodemodelConfig::CodemodelConfig(cmFileAPI& fileAPI, unsigned long version,
+CodemodelConfig::CodemodelConfig(cmFileAPI& fileAPI, unsigned int version,
                                  std::string const& config)
   : FileAPI(fileAPI)
   , Version(version)
@@ -2154,7 +2154,7 @@ Json::Value Target::DumpDebugger()
   return debuggerInformation;
 }
 
-Json::Value cmFileAPICodemodelDump(cmFileAPI& fileAPI, unsigned long version)
+Json::Value cmFileAPICodemodelDump(cmFileAPI& fileAPI, unsigned int version)
 {
   Codemodel codemodel(fileAPI, version);
   return codemodel.Dump();

+ 1 - 1
Source/cmFileAPICodemodel.h

@@ -9,4 +9,4 @@
 class cmFileAPI;
 
 extern Json::Value cmFileAPICodemodelDump(cmFileAPI& fileAPI,
-                                          unsigned long version);
+                                          unsigned int version);

+ 4 - 5
Source/cmFileAPIConfigureLog.cxx

@@ -13,17 +13,17 @@ namespace {
 class ConfigureLog
 {
   cmFileAPI& FileAPI;
-  unsigned long Version;
+  unsigned int Version;
 
   Json::Value DumpPath();
   Json::Value DumpEventKindNames();
 
 public:
-  ConfigureLog(cmFileAPI& fileAPI, unsigned long version);
+  ConfigureLog(cmFileAPI& fileAPI, unsigned int version);
   Json::Value Dump();
 };
 
-ConfigureLog::ConfigureLog(cmFileAPI& fileAPI, unsigned long version)
+ConfigureLog::ConfigureLog(cmFileAPI& fileAPI, unsigned int version)
   : FileAPI(fileAPI)
   , Version(version)
 {
@@ -62,8 +62,7 @@ Json::Value ConfigureLog::DumpEventKindNames()
 }
 }
 
-Json::Value cmFileAPIConfigureLogDump(cmFileAPI& fileAPI,
-                                      unsigned long version)
+Json::Value cmFileAPIConfigureLogDump(cmFileAPI& fileAPI, unsigned int version)
 {
   ConfigureLog configureLog(fileAPI, version);
   return configureLog.Dump();

+ 1 - 1
Source/cmFileAPIConfigureLog.h

@@ -9,4 +9,4 @@
 class cmFileAPI;
 
 extern Json::Value cmFileAPIConfigureLogDump(cmFileAPI& fileAPI,
-                                             unsigned long version);
+                                             unsigned int version);

+ 4 - 4
Source/cmFileAPIToolchains.cxx

@@ -29,7 +29,7 @@ struct ToolchainVariable
 class Toolchains
 {
   cmFileAPI& FileAPI;
-  unsigned long Version;
+  unsigned int Version;
 
   Json::Value DumpToolchains();
   Json::Value DumpToolchain(std::string const& lang);
@@ -41,11 +41,11 @@ class Toolchains
                              ToolchainVariable const& variable);
 
 public:
-  Toolchains(cmFileAPI& fileAPI, unsigned long version);
+  Toolchains(cmFileAPI& fileAPI, unsigned int version);
   Json::Value Dump();
 };
 
-Toolchains::Toolchains(cmFileAPI& fileAPI, unsigned long version)
+Toolchains::Toolchains(cmFileAPI& fileAPI, unsigned int version)
   : FileAPI(fileAPI)
   , Version(version)
 {
@@ -143,7 +143,7 @@ void Toolchains::DumpToolchainVariable(cmMakefile const* mf,
 }
 }
 
-Json::Value cmFileAPIToolchainsDump(cmFileAPI& fileAPI, unsigned long version)
+Json::Value cmFileAPIToolchainsDump(cmFileAPI& fileAPI, unsigned int version)
 {
   Toolchains toolchains(fileAPI, version);
   return toolchains.Dump();

+ 1 - 1
Source/cmFileAPIToolchains.h

@@ -9,4 +9,4 @@
 class cmFileAPI;
 
 extern Json::Value cmFileAPIToolchainsDump(cmFileAPI& fileAPI,
-                                           unsigned long version);
+                                           unsigned int version);

+ 1 - 1
Source/cmMessageCommand.cxx

@@ -69,7 +69,7 @@ void WriteMessageEvent(cmConfigureLog& log, cmMakefile const& mf,
                        std::string const& message)
 {
   // Keep in sync with cmFileAPIConfigureLog's DumpEventKindNames.
-  static std::vector<unsigned long> const LogVersionsWithMessageV1{ 1 };
+  static std::vector<unsigned int> const LogVersionsWithMessageV1{ 1 };
 
   if (log.IsAnyLogVersionEnabled(LogVersionsWithMessageV1)) {
     log.BeginEvent("message-v1", mf);

+ 1 - 1
Source/cmTryCompileCommand.cxx

@@ -22,7 +22,7 @@ void WriteTryCompileEvent(cmConfigureLog& log, cmMakefile const& mf,
                           cmTryCompileResult const& compileResult)
 {
   // Keep in sync with cmFileAPIConfigureLog's DumpEventKindNames.
-  static std::vector<unsigned long> const LogVersionsWithTryCompileV1{ 1 };
+  static std::vector<unsigned int> const LogVersionsWithTryCompileV1{ 1 };
 
   if (log.IsAnyLogVersionEnabled(LogVersionsWithTryCompileV1)) {
     log.BeginEvent("try_compile-v1", mf);

+ 1 - 1
Source/cmTryRunCommand.cxx

@@ -41,7 +41,7 @@ void WriteTryRunEvent(cmConfigureLog& log, cmMakefile const& mf,
                       cmTryRunResult const& runResult)
 {
   // Keep in sync with cmFileAPIConfigureLog's DumpEventKindNames.
-  static std::vector<unsigned long> const LogVersionsWithTryRunV1{ 1 };
+  static std::vector<unsigned int> const LogVersionsWithTryRunV1{ 1 };
 
   if (log.IsAnyLogVersionEnabled(LogVersionsWithTryRunV1)) {
     log.BeginEvent("try_run-v1", mf);