summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2020-05-01 02:00:00 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2020-04-30 14:45:45 (GMT)
commite267c3fddf68dc27a0e756a5d7f5dc618bf3f7eb (patch)
tree51253a7d8399e05e48a618aeafd805a985cbb411 /Source
parentc09efe074d793203ab846e97bde8d03e4714dc2a (diff)
downloadCMake-e267c3fddf68dc27a0e756a5d7f5dc618bf3f7eb.zip
CMake-e267c3fddf68dc27a0e756a5d7f5dc618bf3f7eb.tar.gz
CMake-e267c3fddf68dc27a0e756a5d7f5dc618bf3f7eb.tar.bz2
cmState::GetInitializedCacheValue: return cmProp
cmProp alias is used; no actual change in type
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx3
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx3
-rw-r--r--Source/cmGlobalGenerator.cxx7
-rw-r--r--Source/cmMakefile.cxx7
-rw-r--r--Source/cmServerProtocol.cxx6
-rw-r--r--Source/cmState.cxx3
-rw-r--r--Source/cmState.h2
-rw-r--r--Source/cmake.cxx23
8 files changed, 24 insertions, 30 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 379836a..0516d26 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -69,8 +69,7 @@ const char* cmCommandArgumentParserHelper::ExpandSpecialVariable(
return "";
}
if (strcmp(key, "CACHE") == 0) {
- if (const std::string* c =
- this->Makefile->GetState()->GetInitializedCacheValue(var)) {
+ if (cmProp c = this->Makefile->GetState()->GetInitializedCacheValue(var)) {
if (this->EscapeQuotes) {
return this->AddString(cmEscapeQuotes(*c));
}
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index b65f097..80d61c3 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -243,8 +243,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
const bool envVarSet = cmSystemTools::GetEnv(envVar, envVarValue);
std::string cacheEntryName = cmStrCat("CMAKE_ECLIPSE_ENVVAR_", envVar);
- const std::string* cacheValue =
- lg.GetState()->GetInitializedCacheValue(cacheEntryName);
+ cmProp cacheValue = lg.GetState()->GetInitializedCacheValue(cacheEntryName);
// now we have both, decide which one to use
std::string valueToUse;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2664fb0..53aa9f3 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -232,7 +232,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
if (!optional && (path.empty() || !cmSystemTools::FileExists(path))) {
return;
}
- const std::string* cname =
+ cmProp cname =
this->GetCMakeInstance()->GetState()->GetInitializedCacheValue(langComp);
std::string changeVars;
if (cname && !optional) {
@@ -2057,9 +2057,8 @@ void cmGlobalGenerator::AddMakefile(std::unique_ptr<cmMakefile> mf)
// update progress
// estimate how many lg there will be
- const std::string* numGenC =
- this->CMakeInstance->GetState()->GetInitializedCacheValue(
- "CMAKE_NUMBER_OF_MAKEFILES");
+ cmProp numGenC = this->CMakeInstance->GetState()->GetInitializedCacheValue(
+ "CMAKE_NUMBER_OF_MAKEFILES");
if (!numGenC) {
// If CMAKE_NUMBER_OF_MAKEFILES is not set
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 028b0f5..9ab59ea 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1880,8 +1880,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
cmStateEnums::CacheEntryType type,
bool force)
{
- const std::string* existingValue =
- this->GetState()->GetInitializedCacheValue(name);
+ cmProp existingValue = this->GetState()->GetInitializedCacheValue(name);
// must be outside the following if() to keep it alive long enough
std::string nvalue;
@@ -2682,7 +2681,7 @@ const std::string& cmMakefile::GetRequiredDefinition(
bool cmMakefile::IsDefinitionSet(const std::string& name) const
{
- const std::string* def = this->StateSnapshot.GetDefinition(name);
+ cmProp def = this->StateSnapshot.GetDefinition(name);
if (!def) {
def = this->GetState()->GetInitializedCacheValue(name);
}
@@ -2699,7 +2698,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
const std::string* cmMakefile::GetDef(const std::string& name) const
{
- const std::string* def = this->StateSnapshot.GetDefinition(name);
+ cmProp def = this->StateSnapshot.GetDefinition(name);
if (!def) {
def = this->GetState()->GetInitializedCacheValue(name);
}
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 10e6317..f6154eb 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -26,6 +26,8 @@
#include "cmSystemTools.h"
#include "cmake.h"
+using cmProp = const std::string*; // just to silence IWYU
+
// Get rid of some windows macros:
#undef max
@@ -562,7 +564,7 @@ cmServerResponse cmServerProtocol1::ProcessConfigure(
if (cm->LoadCache(buildDir)) {
// build directory has been set up before
- const std::string* cachedSourceDir =
+ cmProp cachedSourceDir =
cm->GetState()->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
if (!cachedSourceDir) {
return request.ReportError("No CMAKE_HOME_DIRECTORY found in cache.");
@@ -572,7 +574,7 @@ cmServerResponse cmServerProtocol1::ProcessConfigure(
cm->SetHomeDirectory(sourceDir);
}
- const std::string* cachedGenerator =
+ cmProp cachedGenerator =
cm->GetState()->GetInitializedCacheValue("CMAKE_GENERATOR");
if (cachedGenerator) {
if (gg && gg->GetName() != *cachedGenerator) {
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 2e748d3..df013f4 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -155,8 +155,7 @@ std::string cmState::GetSafeCacheEntryValue(std::string const& key) const
return std::string();
}
-const std::string* cmState::GetInitializedCacheValue(
- std::string const& key) const
+cmProp cmState::GetInitializedCacheValue(std::string const& key) const
{
return this->CacheManager->GetInitializedCacheValue(key);
}
diff --git a/Source/cmState.h b/Source/cmState.h
index e3fbfdc..e966935 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -92,7 +92,7 @@ public:
std::vector<std::string> GetCacheEntryKeys() const;
cmProp GetCacheEntryValue(std::string const& key) const;
std::string GetSafeCacheEntryValue(std::string const& key) const;
- const std::string* GetInitializedCacheValue(std::string const& key) const;
+ cmProp GetInitializedCacheValue(std::string const& key) const;
cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const;
void SetCacheEntryValue(std::string const& key, std::string const& value);
void SetCacheValue(std::string const& key, std::string const& value);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index c619e1e..a257a70 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -313,8 +313,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
bool haveValue = false;
std::string cachedValue;
if (this->WarnUnusedCli) {
- if (const std::string* v =
- this->State->GetInitializedCacheValue(var)) {
+ if (cmProp v = this->State->GetInitializedCacheValue(var)) {
haveValue = true;
cachedValue = *v;
}
@@ -1529,9 +1528,8 @@ int cmake::ActualConfigure()
// no generator specified on the command line
if (!this->GlobalGenerator) {
- const std::string* genName =
- this->State->GetInitializedCacheValue("CMAKE_GENERATOR");
- const std::string* extraGenName =
+ cmProp genName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR");
+ cmProp extraGenName =
this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
if (genName) {
std::string fullName =
@@ -1554,8 +1552,7 @@ int cmake::ActualConfigure()
}
}
- const std::string* genName =
- this->State->GetInitializedCacheValue("CMAKE_GENERATOR");
+ cmProp genName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR");
if (genName) {
if (!this->GlobalGenerator->MatchesGeneratorName(*genName)) {
std::string message =
@@ -1577,7 +1574,7 @@ int cmake::ActualConfigure()
cmStateEnums::INTERNAL);
}
- if (const std::string* instance =
+ if (cmProp instance =
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_INSTANCE")) {
if (this->GeneratorInstanceSet && this->GeneratorInstance != *instance) {
std::string message =
@@ -1594,7 +1591,7 @@ int cmake::ActualConfigure()
"Generator instance identifier.", cmStateEnums::INTERNAL);
}
- if (const std::string* platformName =
+ if (cmProp platformName =
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) {
if (this->GeneratorPlatformSet &&
this->GeneratorPlatform != *platformName) {
@@ -1612,7 +1609,7 @@ int cmake::ActualConfigure()
"Name of generator platform.", cmStateEnums::INTERNAL);
}
- if (const std::string* tsName =
+ if (cmProp tsName =
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) {
if (this->GeneratorToolsetSet && this->GeneratorToolset != *tsName) {
std::string message =
@@ -1983,7 +1980,7 @@ std::string cmake::StripExtension(const std::string& file) const
const char* cmake::GetCacheDefinition(const std::string& name) const
{
- const std::string* p = this->State->GetInitializedCacheValue(name);
+ cmProp p = this->State->GetInitializedCacheValue(name);
return p ? p->c_str() : nullptr;
}
@@ -2190,7 +2187,7 @@ void cmake::PrintGeneratorList()
void cmake::UpdateConversionPathTable()
{
// Update the path conversion table with any specified file:
- const std::string* tablepath =
+ cmProp tablepath =
this->State->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE");
if (tablepath) {
@@ -2834,7 +2831,7 @@ bool cmake::Open(const std::string& dir, bool dryRun)
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
return false;
}
- const std::string* extraGenName =
+ cmProp extraGenName =
this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
std::string fullName =
cmExternalMakefileProjectGenerator::CreateFullGeneratorName(