summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2021-05-10 15:00:00 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2021-05-10 15:44:53 (GMT)
commitce97b7909bdd4be78c4be2e2326c5ae3e27a21f0 (patch)
tree32bc3a55e37750af01a03e90abbd78c9e1b948ff /Source
parent2ee55f9718264d716eeabc9d61ede6e434443fd1 (diff)
downloadCMake-ce97b7909bdd4be78c4be2e2326c5ae3e27a21f0.zip
CMake-ce97b7909bdd4be78c4be2e2326c5ae3e27a21f0.tar.gz
CMake-ce97b7909bdd4be78c4be2e2326c5ae3e27a21f0.tar.bz2
Source: Remove unnecessary comparisons to nullptr
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExportFileGenerator.cxx2
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx6
-rw-r--r--Source/cmExtraKateGenerator.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx11
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx6
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmMakefileTargetGenerator.cxx2
-rw-r--r--Source/cmNinjaTargetGenerator.cxx2
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx2
-rw-r--r--Source/cmQtAutoGenInitializer.cxx34
-rw-r--r--Source/cmStandardLevelResolver.cxx2
-rw-r--r--Source/cmXCodeScheme.cxx2
-rw-r--r--Source/cmake.cxx6
14 files changed, 40 insertions, 43 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 0409f97..dd611de 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -1229,7 +1229,7 @@ bool cmExportFileGenerator::PopulateExportProperties(
return false;
}
cmProp propertyValue = targetProperties.GetPropertyValue(prop);
- if (propertyValue == nullptr) {
+ if (!propertyValue) {
// Asked to export a property that isn't defined on the target. Do not
// consider this an error, there's just nothing to export.
continue;
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 824f5ed..70d373c 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -248,17 +248,17 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
// now we have both, decide which one to use
std::string valueToUse;
- if (!envVarSet && cacheValue == nullptr) {
+ if (!envVarSet && !cacheValue) {
// nothing known, do nothing
valueToUse.clear();
- } else if (envVarSet && cacheValue == nullptr) {
+ } else if (envVarSet && !cacheValue) {
// The variable is in the env, but not in the cache. Use it and put it
// in the cache
valueToUse = envVarValue;
mf->AddCacheDefinition(cacheEntryName, valueToUse, cacheEntryName.c_str(),
cmStateEnums::STRING, true);
mf->GetCMakeInstance()->SaveCache(lg.GetBinaryDirectory());
- } else if (!envVarSet && cacheValue != nullptr) {
+ } else if (!envVarSet && cacheValue) {
// It is already in the cache, but not in the env, so use it from the cache
valueToUse = *cacheValue;
} else {
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 54c3114..9153119 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -130,7 +130,7 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator& lg,
if (targetName == "edit_cache") {
cmProp editCommand =
localGen->GetMakefile()->GetDefinition("CMAKE_EDIT_COMMAND");
- if (editCommand == nullptr ||
+ if (!editCommand ||
strstr(editCommand->c_str(), "ccmake") != nullptr) {
insertTarget = false;
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 365f8b8..bbc0050 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -970,7 +970,7 @@ cmProp cmGeneratorTarget::GetPropertyWithPairedLanguageSupport(
std::string const& lang, const char* suffix) const
{
cmProp propertyValue = this->Target->GetProperty(cmStrCat(lang, suffix));
- if (propertyValue == nullptr) {
+ if (!propertyValue) {
// Check if we should use the value set by another language.
if (lang == "OBJC") {
propertyValue = this->GetPropertyWithPairedLanguageSupport("C", suffix);
@@ -4715,21 +4715,20 @@ bool cmGeneratorTarget::ComputeCompileFeatures(
cmStrCat(cmSystemTools::UpperCase(config), '-', language.first);
BTs<std::string> const* standardToCopy =
this->GetLanguageStandardProperty(language.second, config);
- if (standardToCopy != nullptr) {
+ if (standardToCopy) {
this->LanguageStandardMap[key] = *standardToCopy;
generatorTargetLanguageStandard = &this->LanguageStandardMap[key];
} else {
cmProp defaultStandard = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", language.second, "_STANDARD_DEFAULT"));
- if (defaultStandard != nullptr) {
+ if (defaultStandard) {
this->LanguageStandardMap[key] = BTs<std::string>(*defaultStandard);
generatorTargetLanguageStandard = &this->LanguageStandardMap[key];
}
}
// Custom updates for the CUDA standard.
- if (generatorTargetLanguageStandard != nullptr &&
- language.first == "CUDA") {
+ if (generatorTargetLanguageStandard && language.first == "CUDA") {
if (generatorTargetLanguageStandard->Value == "98") {
this->LanguageStandardMap[key].Value = "03";
}
@@ -6771,7 +6770,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
return;
}
iface.Exists = true;
- iface.Explicit = cmp0022NEW || explicitLibraries != nullptr;
+ iface.Explicit = cmp0022NEW || explicitLibraries;
if (explicitLibraries) {
// The interface libraries have been explicitly set.
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index ed5bff5..9a17d07 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -710,7 +710,7 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
std::ostream& fout, const cmSourceFile* sourceFile)
{
cmProp rawLangProp = sourceFile->GetProperty("LANGUAGE");
- if (nullptr != rawLangProp) {
+ if (rawLangProp) {
std::string sourceLangProp(*rawLangProp);
std::string const& extension = sourceFile->GetExtension();
if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) {
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b83a187..db7357a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2438,7 +2438,7 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target)
}
cmProp ispcHeaderSuffixProp = target->GetProperty("ISPC_HEADER_SUFFIX");
- assert(ispcHeaderSuffixProp != nullptr);
+ assert(ispcHeaderSuffixProp);
std::vector<std::string> ispcArchSuffixes =
detail::ComputeISPCObjectSuffixes(target);
@@ -3001,7 +3001,7 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
const std::string name = "CMAKE_" + lang + "_LINK_OPTIONS_IPO";
cmProp rawFlagsList = this->Makefile->GetDefinition(name);
- if (rawFlagsList == nullptr) {
+ if (!rawFlagsList) {
return;
}
@@ -3240,7 +3240,7 @@ void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
{
cmProp optionList = this->Makefile->GetDefinition(
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_", feature));
- if (optionList != nullptr) {
+ if (optionList) {
std::vector<std::string> options = cmExpandedList(*optionList);
for (std::string const& o : options) {
this->AppendFlagEscape(flags, o);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index a3940ea..cead87b 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1214,7 +1214,7 @@ void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool(
cmProp additionalFiles =
target->GetProperty("DEPLOYMENT_ADDITIONAL_FILES");
- if (dir == nullptr && additionalFiles == nullptr) {
+ if (!dir && !additionalFiles) {
return;
}
@@ -1228,7 +1228,7 @@ void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool(
<< GetEscapedPropertyIfValueNotNULL(additionalFiles->c_str())
<< "\"/>\n";
- if (dir != nullptr) {
+ if (dir) {
std::string const exe = *dir + "\\" + target->GetFullName(config);
fout << "\t\t\t<DebuggerTool\n"
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 5b6c58d..e07e722 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -663,7 +663,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
cmProp ispcSuffixProp =
this->GeneratorTarget->GetProperty("ISPC_HEADER_SUFFIX");
- assert(ispcSuffixProp != nullptr);
+ assert(ispcSuffixProp);
std::string directory = this->GeneratorTarget->GetObjectDirectory(config);
if (cmProp prop =
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index f7777fc..ce0d869 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1444,7 +1444,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmProp ispcSuffixProp =
this->GeneratorTarget->GetProperty("ISPC_HEADER_SUFFIX");
- assert(ispcSuffixProp != nullptr);
+ assert(ispcSuffixProp);
std::string ispcHeaderDirectory =
this->GeneratorTarget->GetObjectDirectory(config);
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 153cb6d..77fe87e 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -185,7 +185,7 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget(
{
cmProp folder =
makefile->GetState()->GetGlobalProperty("AUTOGEN_TARGETS_FOLDER");
- if (folder != nullptr) {
+ if (folder) {
target->SetProperty("FOLDER", *folder);
}
}
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 148591c..2894201 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -114,10 +114,10 @@ bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin,
// Collect all static_library dependencies from the test target
cmLinkImplementationLibraries const* libs =
testTarget->GetLinkImplementationLibraries(config);
- if (libs != nullptr) {
+ if (libs) {
for (cmLinkItem const& item : libs->Libraries) {
cmGeneratorTarget const* depTarget = item.Target;
- if ((depTarget != nullptr) &&
+ if (depTarget &&
(depTarget->GetType() == cmStateEnums::STATIC_LIBRARY) &&
knownLibs.insert(depTarget).second) {
testLibs.push_back(depTarget);
@@ -357,15 +357,15 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
{
cmProp folder =
this->Makefile->GetState()->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER");
- if (folder == nullptr) {
+ if (!folder) {
folder = this->Makefile->GetState()->GetGlobalProperty(
"AUTOGEN_TARGETS_FOLDER");
}
// Inherit FOLDER property from target (#13688)
- if (folder == nullptr) {
+ if (!folder) {
folder = this->GenTarget->GetProperty("FOLDER");
}
- if (folder != nullptr) {
+ if (folder) {
this->TargetsFolder = *folder;
}
}
@@ -490,7 +490,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
for (std::string const& depName : cmExpandedList(deps)) {
// Allow target and file dependencies
auto* depTarget = this->Makefile->FindTargetToUse(depName);
- if (depTarget != nullptr) {
+ if (depTarget) {
this->AutogenTarget.DependTargets.insert(depTarget);
} else {
this->AutogenTarget.DependFiles.insert(depName);
@@ -662,7 +662,7 @@ bool cmQtAutoGenInitializer::InitMoc()
return false;
}
// Let the _autogen target depend on the moc executable
- if (this->Moc.ExecutableTarget != nullptr) {
+ if (this->Moc.ExecutableTarget) {
this->AutogenTarget.DependTargets.insert(
this->Moc.ExecutableTarget->Target);
}
@@ -710,7 +710,7 @@ bool cmQtAutoGenInitializer::InitUic()
return false;
}
// Let the _autogen target depend on the uic executable
- if (this->Uic.ExecutableTarget != nullptr) {
+ if (this->Uic.ExecutableTarget) {
this->AutogenTarget.DependTargets.insert(
this->Uic.ExecutableTarget->Target);
}
@@ -865,7 +865,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
auto constexpr locationKind = cmSourceFileLocationKind::Known;
cmSourceFile* sf =
this->Makefile->GetSource(fullPath, locationKind);
- if (sf != nullptr) {
+ if (sf) {
// Check if we know about this header already
if (cm::contains(this->AutogenTarget.Headers, sf)) {
continue;
@@ -880,7 +880,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
sf = this->Makefile->CreateSource(fullPath, false, locationKind);
}
- if (sf != nullptr) {
+ if (sf) {
auto eMuf = makeMUFile(sf, fullPath, muf.Configs, true);
// Only process moc/uic when the parent is processed as well
if (!muf.MocIt) {
@@ -1243,10 +1243,10 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
for (std::string const& config : this->ConfigsList) {
cmLinkImplementationLibraries const* libs =
this->GenTarget->GetLinkImplementationLibraries(config);
- if (libs != nullptr) {
+ if (libs) {
for (cmLinkItem const& item : libs->Libraries) {
cmGeneratorTarget const* libTarget = item.Target;
- if ((libTarget != nullptr) &&
+ if (libTarget &&
!StaticLibraryCycle(this->GenTarget, libTarget, config)) {
// Increment target config count
commonTargets[libTarget]++;
@@ -1780,7 +1780,7 @@ void cmQtAutoGenInitializer::AddToSourceGroup(std::string const& fileName,
// Generate a source group on demand
if (!groupName.empty()) {
sourceGroup = this->Makefile->GetOrCreateSourceGroup(groupName);
- if (sourceGroup == nullptr) {
+ if (!sourceGroup) {
cmSystemTools::Error(
cmStrCat(genNameUpper, " error in ", property,
": Could not find or create the source group ",
@@ -1788,7 +1788,7 @@ void cmQtAutoGenInitializer::AddToSourceGroup(std::string const& fileName,
}
}
}
- if (sourceGroup != nullptr) {
+ if (sourceGroup) {
sourceGroup->AddGroupFile(fileName);
}
}
@@ -1894,14 +1894,14 @@ cmQtAutoGenInitializer::GetQtVersion(cmGeneratorTarget const* target,
// Converts a char ptr to an unsigned int value
auto toUInt = [](const char* const input) -> unsigned int {
unsigned long tmp = 0;
- if (input != nullptr && cmStrToULong(input, &tmp)) {
+ if (input && cmStrToULong(input, &tmp)) {
return static_cast<unsigned int>(tmp);
}
return 0u;
};
auto toUInt2 = [](cmProp input) -> unsigned int {
unsigned long tmp = 0;
- if (input != nullptr && cmStrToULong(*input, &tmp)) {
+ if (input && cmStrToULong(*input, &tmp)) {
return static_cast<unsigned int>(tmp);
}
return 0u;
@@ -2073,7 +2073,7 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
// Find target
cmGeneratorTarget* genTarget =
this->LocalGen->FindGeneratorTargetToUse(targetName);
- if (genTarget != nullptr) {
+ if (genTarget) {
genVars.ExecutableTargetName = targetName;
genVars.ExecutableTarget = genTarget;
if (genTarget->IsImported()) {
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index 280e508..85411e6 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -184,7 +184,7 @@ struct StanardLevelComputer
auto needed = this->HighestStandardNeeded(makefile, feature);
cmProp existingStandard = currentLangStandardValue;
- if (existingStandard == nullptr) {
+ if (!existingStandard) {
cmProp defaultStandard = makefile->GetDefinition(
cmStrCat("CMAKE_", this->Language, "_STANDARD_DEFAULT"));
if (cmNonempty(defaultStandard)) {
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index 55e941d..e4329af 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -324,7 +324,7 @@ bool cmXCodeScheme::WriteLaunchActionBooleanAttribute(
bool defaultValue)
{
cmProp property = Target->GetTarget()->GetProperty(varName);
- bool isOn = (property == nullptr && defaultValue) || cmIsOn(property);
+ bool isOn = (!property && defaultValue) || cmIsOn(property);
if (isOn) {
xout.Attribute(attrName.c_str(), "YES");
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index a08babe..225fa3c 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1251,15 +1251,13 @@ void cmake::SetArgs(const std::vector<std::string>& args)
this->UnprocessedPresetEnvironment = expandedPreset->Environment;
if (!expandedPreset->InstallDir.empty() &&
- this->State->GetInitializedCacheValue("CMAKE_INSTALL_PREFIX") ==
- nullptr) {
+ !this->State->GetInitializedCacheValue("CMAKE_INSTALL_PREFIX")) {
this->UnprocessedPresetVariables["CMAKE_INSTALL_PREFIX"] = {
"PATH", expandedPreset->InstallDir
};
}
if (!expandedPreset->ToolchainFile.empty() &&
- this->State->GetInitializedCacheValue("CMAKE_TOOLCHAIN_FILE") ==
- nullptr) {
+ !this->State->GetInitializedCacheValue("CMAKE_TOOLCHAIN_FILE")) {
this->UnprocessedPresetVariables["CMAKE_TOOLCHAIN_FILE"] = {
"FILEPATH", expandedPreset->ToolchainFile
};