From b3edfcf46ec1514a376d4e3dca7538cc750844d5 Mon Sep 17 00:00:00 2001 From: Vitaly Stakhovsky Date: Sun, 15 Jan 2023 10:13:14 -0500 Subject: cmValue: Use operator* explicitly to convert to std::string; avoid extra call --- Source/CPack/IFW/cmCPackIFWGenerator.cxx | 2 +- Source/CPack/IFW/cmCPackIFWInstaller.cxx | 38 ++++++++++++++++-------------- Source/CPack/IFW/cmCPackIFWPackage.cxx | 6 ++--- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 8 +++---- Source/CPack/cmCPackArchiveGenerator.cxx | 8 +++---- Source/CPack/cmCPackDebGenerator.cxx | 6 ++--- Source/CPack/cmCPackExternalGenerator.cxx | 4 ++-- Source/CPack/cmCPackGenerator.cxx | 36 ++++++++++++++-------------- Source/CPack/cmCPackNSISGenerator.cxx | 2 +- Source/CPack/cmCPackPKGGenerator.cxx | 17 ++++++------- Source/CTest/cmCTestSubmitHandler.cxx | 2 +- Source/CTest/cmCTestTestHandler.cxx | 19 ++++++++------- Source/CTest/cmCTestUpdateHandler.cxx | 4 ++-- Source/cmComputeLinkDepends.cxx | 6 ++--- Source/cmComputeLinkInformation.cxx | 10 ++++---- Source/cmFindBase.cxx | 2 +- Source/cmFindPackageCommand.cxx | 2 +- Source/cmGeneratorTarget.cxx | 4 ++-- Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalGhsMultiGenerator.cxx | 6 ++--- Source/cmGlobalVisualStudio71Generator.cxx | 2 +- Source/cmLocalGenerator.cxx | 8 +++---- Source/cmLocalXCodeGenerator.cxx | 2 +- Source/cmMakefile.cxx | 3 ++- Source/cmSearchPath.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- 26 files changed, 104 insertions(+), 99 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 9dd8fe3..bc14eb4 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -585,7 +585,7 @@ std::string cmCPackIFWGenerator::GetRootPackageName() // Configure from root group cmCPackIFWPackage package; package.Generator = this; - package.ConfigureFromGroup(optIFW_PACKAGE_GROUP); + package.ConfigureFromGroup(*optIFW_PACKAGE_GROUP); name = package.Name; } else if (cmValue optIFW_PACKAGE_NAME = this->GetOption("CPACK_IFW_PACKAGE_NAME")) { diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 2feca75..69440d9 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -77,19 +77,20 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // ApplicationIcon if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_ICON")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->InstallerApplicationIcon = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", *option); } } // WindowIcon if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->InstallerWindowIcon = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", + *option); } } @@ -104,37 +105,37 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // Logo if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_LOGO")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Logo = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", *option); } } // Watermark if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_WATERMARK")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Watermark = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", *option); } } // Banner if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_BANNER")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Banner = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", *option); } } // Background if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Background = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", *option); } } @@ -155,10 +156,11 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // StyleSheet if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_STYLE_SHEET")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->StyleSheet = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_STYLE_SHEET", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_STYLE_SHEET", + *option); } } @@ -276,9 +278,9 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // Control script if (cmValue optIFW_CONTROL_SCRIPT = this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) { - if (!cmSystemTools::FileExists(optIFW_CONTROL_SCRIPT)) { + if (!cmSystemTools::FileExists(*optIFW_CONTROL_SCRIPT)) { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_CONTROL_SCRIPT", - optIFW_CONTROL_SCRIPT); + *optIFW_CONTROL_SCRIPT); } else { this->ControlScript = *optIFW_CONTROL_SCRIPT; } @@ -653,9 +655,9 @@ void cmCPackIFWInstaller::GeneratePackageFiles() package.Installer = this; // Check package group if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_GROUP")) { - package.ConfigureFromGroup(option); + package.ConfigureFromGroup(*option); std::string forcedOption = "CPACK_IFW_COMPONENT_GROUP_" + - cmsys::SystemTools::UpperCase(option) + "_FORCED_INSTALLATION"; + cmsys::SystemTools::UpperCase(*option) + "_FORCED_INSTALLATION"; if (!this->GetOption(forcedOption)) { package.ForcedInstallation = "true"; } diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index c2109c9..1668fb5 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -382,7 +382,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->DisplayName.clear(); } else if (cmValue value = this->GetOption(option)) { - cmCPackIFWPackage::ExpandListArgument(value, this->DisplayName); + cmCPackIFWPackage::ExpandListArgument(*value, this->DisplayName); } // Description @@ -390,7 +390,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->Description.clear(); } else if (cmValue value = this->GetOption(option)) { - cmCPackIFWPackage::ExpandListArgument(value, this->Description); + cmCPackIFWPackage::ExpandListArgument(*value, this->Description); } // Release date @@ -484,7 +484,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->Default.clear(); } else if (cmValue value = this->GetOption(option)) { - std::string lowerValue = cmsys::SystemTools::LowerCase(value); + std::string lowerValue = cmsys::SystemTools::LowerCase(*value); if (lowerValue == "true") { this->Default = "true"; } else if (lowerValue == "false") { diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 5dae966..aeb3db3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -422,9 +422,9 @@ void cmCPackWIXGenerator::CopyDefinition(cmWIXSourceWriter& source, cmValue value = GetOption(name); if (value) { if (type == DefinitionType::PATH) { - AddDefinition(source, name, CMakeToWixPath(value)); + AddDefinition(source, name, CMakeToWixPath(*value)); } else { - AddDefinition(source, name, value); + AddDefinition(source, name, *value); } } } @@ -504,7 +504,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() } featureDefinitions.AddAttribute("Title", featureTitle); if (cmValue desc = GetOption("CPACK_WIX_ROOT_FEATURE_DESCRIPTION")) { - featureDefinitions.AddAttribute("Description", desc); + featureDefinitions.AddAttribute("Description", *desc); } featureDefinitions.AddAttribute("Level", "1"); this->Patch->ApplyFragment("#PRODUCTFEATURE", featureDefinitions); @@ -512,7 +512,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() cmValue package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY"); if (package) { featureDefinitions.CreateCMakePackageRegistryEntry( - package, GetOption("CPACK_WIX_UPGRADE_GUID")); + *package, GetOption("CPACK_WIX_UPGRADE_GUID")); } if (!CreateFeatureHierarchy(featureDefinitions)) { diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 894c24b..c9c069c 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -80,10 +80,10 @@ std::string cmCPackArchiveGenerator::GetArchiveComponentFileName( *this->GetOption("CPACK_ARCHIVE_" + componentUpper + "_FILE_NAME"); } else if (this->IsSet("CPACK_ARCHIVE_FILE_NAME")) { packageFileName += this->GetComponentPackageFileName( - this->GetOption("CPACK_ARCHIVE_FILE_NAME"), component, isGroupName); + *this->GetOption("CPACK_ARCHIVE_FILE_NAME"), component, isGroupName); } else { packageFileName += this->GetComponentPackageFileName( - this->GetOption("CPACK_PACKAGE_FILE_NAME"), component, isGroupName); + *this->GetOption("CPACK_PACKAGE_FILE_NAME"), component, isGroupName); } packageFileName += this->GetOutputExtension(); @@ -357,9 +357,9 @@ int cmCPackArchiveGenerator::GetThreadCount() const // CPACK_ARCHIVE_THREADS overrides CPACK_THREADS if (this->IsSet("CPACK_ARCHIVE_THREADS")) { - threads = std::stoi(this->GetOption("CPACK_ARCHIVE_THREADS")); + threads = std::stoi(*this->GetOption("CPACK_ARCHIVE_THREADS")); } else if (this->IsSet("CPACK_THREADS")) { - threads = std::stoi(this->GetOption("CPACK_THREADS")); + threads = std::stoi(*this->GetOption("CPACK_THREADS")); } return threads; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index a3b9434..6ba28d1 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -124,8 +124,8 @@ DebGenerator::DebGenerator( << debianCompressionType << std::endl); } - if (numThreads != nullptr) { - if (!cmStrToLong(numThreads, &this->NumThreads)) { + if (numThreads) { + if (!cmStrToLong(*numThreads, &this->NumThreads)) { this->NumThreads = 1; cmCPackLogger(cmCPackLog::LOG_ERROR, "Unrecognized number of threads: " << numThreads @@ -703,7 +703,7 @@ bool cmCPackDebGenerator::createDebPackages() &cmCPackDebGenerator::createDeb); cmValue dbgsymdir_path = this->GetOption("GEN_DBGSYMDIR"); if (this->IsOn("GEN_CPACK_DEBIAN_DEBUGINFO_PACKAGE") && dbgsymdir_path) { - retval = make_package(dbgsymdir_path, "GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME", + retval = make_package(*dbgsymdir_path, "GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME", &cmCPackDebGenerator::createDbgsymDDeb) && retval; } diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index edd8490..4c92592 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -63,7 +63,7 @@ int cmCPackExternalGenerator::PackageFiles() cmValue packageScript = this->GetOption("CPACK_EXTERNAL_PACKAGE_SCRIPT"); if (cmNonempty(packageScript)) { - if (!cmSystemTools::FileIsFullPath(packageScript)) { + if (!cmSystemTools::FileIsFullPath(*packageScript)) { cmCPackLogger( cmCPackLog::LOG_ERROR, "CPACK_EXTERNAL_PACKAGE_SCRIPT does not contain a full file path" @@ -71,7 +71,7 @@ int cmCPackExternalGenerator::PackageFiles() return 0; } - bool res = this->MakefileMap->ReadListFile(packageScript); + bool res = this->MakefileMap->ReadListFile(*packageScript); if (cmSystemTools::GetErrorOccurredFlag() || !res) { return 0; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 90d15f8..2ac5b3d 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -91,7 +91,7 @@ int cmCPackGenerator::PrepareNames() "CPACK_PACKAGE_FILE_NAME not specified" << std::endl); return 0; } - std::string outName = pfname; + std::string outName = *pfname; tempDirectory += "/" + outName; if (!this->GetOutputExtension()) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -106,7 +106,7 @@ int cmCPackGenerator::PrepareNames() return 0; } - std::string destFile = pdir; + std::string destFile = *pdir; this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PREFIX", destFile); destFile += "/" + outName; std::string outFile = topDirectory + "/" + outName; @@ -126,17 +126,17 @@ int cmCPackGenerator::PrepareNames() cmValue descFileName = this->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE"); if (descFileName && !this->GetOption("CPACK_PACKAGE_DESCRIPTION")) { cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Look for: " << descFileName << std::endl); - if (!cmSystemTools::FileExists(descFileName)) { + "Look for: " << *descFileName << std::endl); + if (!cmSystemTools::FileExists(*descFileName)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find description file name: [" - << descFileName << "]" << std::endl); + << *descFileName << "]" << std::endl); return 0; } cmsys::ifstream ifs(descFileName->c_str()); if (!ifs) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot open description file name: " << descFileName + "Cannot open description file name: " << *descFileName << std::endl); return 0; } @@ -144,14 +144,14 @@ int cmCPackGenerator::PrepareNames() std::string line; cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Read description file: " << descFileName << std::endl); + "Read description file: " << *descFileName << std::endl); while (ifs && cmSystemTools::GetLineFromStream(ifs, line)) { ostr << cmXMLSafe(line) << std::endl; } this->SetOption("CPACK_PACKAGE_DESCRIPTION", ostr.str()); cmValue defFileName = this->GetOption("CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE"); - if (defFileName && (defFileName == descFileName)) { + if (defFileName && (*defFileName == *descFileName)) { this->SetOption("CPACK_USED_DEFAULT_PACKAGE_DESCRIPTION_FILE", "ON"); } } @@ -636,7 +636,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::unique_ptr globalGenerator = this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator( - cmakeGenerator); + *cmakeGenerator); if (!globalGenerator) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Specified package generator not found. " @@ -1050,14 +1050,14 @@ int cmCPackGenerator::DoPackage() if (cmIsOn(this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY"))) { cmValue toplevelDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - if (cmSystemTools::FileExists(toplevelDirectory)) { + if (toplevelDirectory && cmSystemTools::FileExists(*toplevelDirectory)) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Remove toplevel directory: " << toplevelDirectory + "Remove toplevel directory: " << *toplevelDirectory << std::endl); - if (!cmSystemTools::RepeatedRemoveDirectory(toplevelDirectory)) { + if (!cmSystemTools::RepeatedRemoveDirectory(*toplevelDirectory)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem removing toplevel directory: " - << toplevelDirectory << std::endl); + << *toplevelDirectory << std::endl); return 0; } } @@ -1091,10 +1091,10 @@ int cmCPackGenerator::DoPackage() "Package files to: " << (tempPackageFileName ? *tempPackageFileName : "(NULL)") << std::endl); - if (cmSystemTools::FileExists(tempPackageFileName)) { + if (tempPackageFileName && cmSystemTools::FileExists(*tempPackageFileName)) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove old package file" << std::endl); - cmSystemTools::RemoveFile(tempPackageFileName); + cmSystemTools::RemoveFile(*tempPackageFileName); } if (cmIsOn(this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY"))) { tempDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); @@ -1211,7 +1211,7 @@ int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) // Load the project specific config file cmValue config = this->GetOption("CPACK_PROJECT_CONFIG_FILE"); if (config) { - mf->ReadListFile(config); + mf->ReadListFile(*config); } int result = this->InitializeInternal(); if (cmSystemTools::GetErrorOccurredFlag()) { @@ -1581,7 +1581,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent( cmValue groupName = this->GetOption(macroPrefix + "_GROUP"); if (cmNonempty(groupName)) { - component->Group = this->GetComponentGroup(projectName, groupName); + component->Group = this->GetComponentGroup(projectName, *groupName); component->Group->Components.push_back(component); } else { component->Group = nullptr; @@ -1644,7 +1644,7 @@ cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup( cmValue parentGroupName = this->GetOption(macroPrefix + "_PARENT_GROUP"); if (cmNonempty(parentGroupName)) { group->ParentGroup = - this->GetComponentGroup(projectName, parentGroupName); + this->GetComponentGroup(projectName, *parentGroupName); group->ParentGroup->Subgroups.push_back(group); } else { group->ParentGroup = nullptr; diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 6ca5783..d7119c5 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -473,7 +473,7 @@ int cmCPackNSISGenerator::InitializeInternal() this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLE", "makensis"); nsisPath = cmSystemTools::FindProgram( - this->GetOption("CPACK_NSIS_EXECUTABLE"), path, false); + *this->GetOption("CPACK_NSIS_EXECUTABLE"), path, false); if (nsisPath.empty()) { cmCPackLogger( diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 7b9f6cf..76ef091 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -58,16 +58,17 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, ? cmStrCat("CPACK_", genName, "_BACKGROUND") : cmStrCat("CPACK_", genName, "_BACKGROUND_", paramSuffix); cmValue bgFileName = this->GetOption(opt); - if (bgFileName == nullptr) { + if (!bgFileName) { return; } - std::string bgFilePath = cmStrCat(metapackageFile, "/Contents/", bgFileName); + std::string bgFilePath = + cmStrCat(metapackageFile, "/Contents/", *bgFileName); if (!cmSystemTools::FileExists(bgFilePath)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Background image doesn't exist in the resource directory: " - << bgFileName << std::endl); + << *bgFileName << std::endl); return; } @@ -77,16 +78,16 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, xout.StartElement(cmStrCat("background-", themeName)); } - xout.Attribute("file", bgFileName); + xout.Attribute("file", *bgFileName); cmValue param = this->GetOption(cmStrCat(opt, "_ALIGNMENT")); if (param != nullptr) { - xout.Attribute("alignment", param); + xout.Attribute("alignment", *param); } param = this->GetOption(cmStrCat(opt, "_SCALING")); if (param != nullptr) { - xout.Attribute("scaling", param); + xout.Attribute("scaling", *param); } // Apple docs say that you must provide either mime-type or uti @@ -94,12 +95,12 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, // doesn't have them, so don't make them mandatory. param = this->GetOption(cmStrCat(opt, "_MIME_TYPE")); if (param != nullptr) { - xout.Attribute("mime-type", param); + xout.Attribute("mime-type", *param); } param = this->GetOption(cmStrCat(opt, "_UTI")); if (param != nullptr) { - xout.Attribute("uti", param); + xout.Attribute("uti", *param); } xout.EndElement(); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index da085a6..2bc270e 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -718,7 +718,7 @@ int cmCTestSubmitHandler::ProcessHandler() cmValue cdashUploadFile = this->GetOption("CDashUploadFile"); cmValue cdashUploadType = this->GetOption("CDashUploadType"); if (cdashUploadFile && cdashUploadType) { - return this->HandleCDashUploadFile(cdashUploadFile, cdashUploadType); + return this->HandleCDashUploadFile(*cdashUploadFile, *cdashUploadType); } const std::string& buildDirectory = diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index daaf5fd..1c8c713 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -363,10 +363,10 @@ void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf) cmValue dval = mf->GetDefinition("CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION"); if (dval) { - if (!this->SetTestOutputTruncation(dval)) { + if (!this->SetTestOutputTruncation(*dval)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: " - << dval << std::endl); + << *dval << std::endl); } } } @@ -520,7 +520,7 @@ bool cmCTestTestHandler::ProcessOptions() if (cmValue repeat = this->GetOption("Repeat")) { cmsys::RegularExpression repeatRegex( "^(UNTIL_FAIL|UNTIL_PASS|AFTER_TIMEOUT):([0-9]+)$"); - if (repeatRegex.find(repeat)) { + if (repeatRegex.find(*repeat)) { std::string const& count = repeatRegex.match(2); unsigned long n = 1; cmStrToULong(count, &n); // regex guarantees success @@ -537,12 +537,13 @@ bool cmCTestTestHandler::ProcessOptions() } } else { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Repeat option invalid value: " << repeat << std::endl); + "Repeat option invalid value: " << *repeat << std::endl); return false; } } if (this->GetOption("ParallelLevel")) { - this->CTest->SetParallelLevel(std::stoi(this->GetOption("ParallelLevel"))); + this->CTest->SetParallelLevel( + std::stoi(*this->GetOption("ParallelLevel"))); } if (this->GetOption("StopOnFailure")) { @@ -556,12 +557,12 @@ bool cmCTestTestHandler::ProcessOptions() cmValue val = this->GetOption("IncludeRegularExpression"); if (val) { this->UseIncludeRegExp(); - this->SetIncludeRegExp(val); + this->SetIncludeRegExp(*val); } val = this->GetOption("ExcludeRegularExpression"); if (val) { this->UseExcludeRegExp(); - this->SetExcludeRegExp(val); + this->SetExcludeRegExp(*val); } val = this->GetOption("ExcludeFixtureRegularExpression"); if (val) { @@ -2110,9 +2111,9 @@ void cmCTestTestHandler::SetTestsToRunInformation(cmValue in) this->TestsToRunString = *in; // if the argument is a file, then read it and use the contents as the // string - if (cmSystemTools::FileExists(in)) { + if (cmSystemTools::FileExists(*in)) { cmsys::ifstream fin(in->c_str()); - unsigned long filelen = cmSystemTools::FileLength(in); + unsigned long filelen = cmSystemTools::FileLength(*in); auto buff = cm::make_unique(filelen + 1); fin.getline(buff.get(), filelen); buff[fin.gcount()] = 0; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index d448c76..045eb84 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -123,7 +123,7 @@ int cmCTestUpdateHandler::ProcessHandler() } cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Updating the repository: " << sourceDirectory + " Updating the repository: " << *sourceDirectory << std::endl, this->Quiet); @@ -163,7 +163,7 @@ int cmCTestUpdateHandler::ProcessHandler() break; } vc->SetCommandLineTool(this->UpdateCommand); - vc->SetSourceDirectory(sourceDirectory); + vc->SetSourceDirectory(*sourceDirectory); // Cleanup the working tree. vc->Cleanup(); diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 8cbdcaa..8e05fac 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -260,8 +260,8 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target, "LINK_LIBRARY_OVERRIDE", nullptr, nullptr }; auto overrideFeature = cmGeneratorExpression::Evaluate( - feature, this->Target->GetLocalGenerator(), config, this->Target, - &dag, this->Target, linkLanguage); + *feature, this->Target->GetLocalGenerator(), config, + this->Target, &dag, this->Target, linkLanguage); this->LinkLibraryOverride.emplace(item, overrideFeature); } } @@ -274,7 +274,7 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target, "LINK_LIBRARY_OVERRIDE", nullptr, nullptr }; auto overrideValue = cmGeneratorExpression::Evaluate( - linkLibraryOverride, target->GetLocalGenerator(), config, target, &dag, + *linkLibraryOverride, target->GetLocalGenerator(), config, target, &dag, target, linkLanguage); auto overrideList = cmTokenize(overrideValue, ","_s); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6cfdf62..cd0a1dc 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -366,7 +366,7 @@ cmComputeLinkInformation::cmComputeLinkInformation( this->LibraryFeatureDescriptors.emplace( "__CMAKE_LINK_EXECUTABLE", LibraryFeatureDescriptor{ "__CMAKE_LINK_EXECUTABLE", - cmStrCat(this->LoaderFlag, "") }); + cmStrCat(*this->LoaderFlag, "") }); } // To link framework using a full path this->LibraryFeatureDescriptors.emplace( @@ -858,8 +858,8 @@ bool cmComputeLinkInformation::AddLibraryFeature(std::string const& feature) return false; } - auto items = - cmExpandListWithBacktrace(langFeature, this->Target->GetBacktrace(), true); + auto items = cmExpandListWithBacktrace(*langFeature, + this->Target->GetBacktrace(), true); if ((items.size() == 1 && !IsValidFeatureFormat(items.front().Value)) || (items.size() == 3 && !IsValidFeatureFormat(items[1].Value))) { @@ -1016,8 +1016,8 @@ cmComputeLinkInformation::GetGroupFeature(std::string const& feature) .first->second; } - auto items = - cmExpandListWithBacktrace(langFeature, this->Target->GetBacktrace(), true); + auto items = cmExpandListWithBacktrace(*langFeature, + this->Target->GetBacktrace(), true); // replace LINKER: pattern this->Target->ResolveLinkerWrapper(items, this->LinkLanguage, true); diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index b8d345f..4df81d5 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -344,7 +344,7 @@ struct entry_to_remove { if (cmValue to_skip = makefile->GetDefinition( cmStrCat("_CMAKE_SYSTEM_PREFIX_PATH_", name, "_PREFIX_COUNT"))) { - cmStrToLong(to_skip, &count); + cmStrToLong(*to_skip, &count); } if (cmValue prefix_value = makefile->GetDefinition( cmStrCat("_CMAKE_SYSTEM_PREFIX_PATH_", name, "_PREFIX_VALUE"))) { diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 71c7e13..c1b82ab 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -2204,7 +2204,7 @@ void cmFindPackageCommand::FillPrefixesCMakeSystemVariable() std::string install_path_to_remove; if (cmValue to_skip = this->Makefile->GetDefinition( "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_COUNT")) { - cmStrToLong(to_skip, &install_prefix_count); + cmStrToLong(*to_skip, &install_prefix_count); } if (cmValue install_value = this->Makefile->GetDefinition( "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE")) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d0d339d..430e4a0 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3572,7 +3572,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink, if (ipoEnabled && compileOrLink == cmBuildStep::Link) { if (cmValue cudaIPOFlags = this->Makefile->GetDefinition("CMAKE_CUDA_LINK_OPTIONS_IPO")) { - flags += cudaIPOFlags; + flags += *cudaIPOFlags; } } @@ -5987,7 +5987,7 @@ std::string valueAsString(std::string value) template <> std::string valueAsString(cmValue value) { - return value ? value : std::string("(unset)"); + return value ? *value : std::string("(unset)"); } template <> std::string valueAsString(std::nullptr_t /*unused*/) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8ca6ee6..40234b1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -947,7 +947,7 @@ void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os, // Subclasses override this method if they do not support this advice. os << "Tell CMake where to find the compiler by setting "; if (envVar) { - os << "either the environment variable \"" << envVar << "\" or "; + os << "either the environment variable \"" << *envVar << "\" or "; } os << "the CMake cache entry CMAKE_" << lang << "_COMPILER " diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 18c48d7..3da15f6 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -100,10 +100,10 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, cmValue prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM"); /* check if the toolset changed from last generate */ - if (cmNonempty(prevTool) && !cmSystemTools::ComparePath(gbuild, prevTool)) { + if (cmNonempty(prevTool) && !cmSystemTools::ComparePath(gbuild, *prevTool)) { std::string const& e = cmStrCat("toolset build tool: ", gbuild, - "\nDoes not match the previously used build tool: ", prevTool, + "\nDoes not match the previously used build tool: ", *prevTool, "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."); mf->IssueMessage(MessageType::FATAL_ERROR, e); @@ -354,7 +354,7 @@ void cmGlobalGhsMultiGenerator::WriteProjectLine( * unsupported target type and should be skipped. */ if (projFile && projType) { - std::string path = cmSystemTools::RelativePath(rootBinaryDir, projFile); + std::string path = cmSystemTools::RelativePath(rootBinaryDir, *projFile); fout << path; fout << ' ' << *projType << '\n'; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 06fd61c..de13924 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -168,7 +168,7 @@ void cmGlobalVisualStudio71Generator::WriteExternalProject( cmValue typeGuid, const std::set>>& depends) { fout << "Project(\"{" - << (typeGuid ? typeGuid + << (typeGuid ? *typeGuid : std::string( cmGlobalVisualStudio71Generator::ExternalProjectType( location))) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cedb367..9a49af1 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -430,7 +430,7 @@ void cmLocalGenerator::GenerateInstallRules() // Compute the install prefix. cmValue installPrefix = this->Makefile->GetDefinition("CMAKE_INSTALL_PREFIX"); - std::string prefix = installPrefix; + std::string prefix = *installPrefix; #if defined(_WIN32) && !defined(__CYGWIN__) if (!installPrefix) { @@ -869,7 +869,7 @@ std::string cmLocalGenerator::GetIncludeFlags( cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang))) { // if there is a separator then the flag is not repeated but is only // given once i.e. -classpath a:b:c - sep = incSep; + sep = *incSep; repeatFlag = false; } @@ -1397,7 +1397,7 @@ void cmLocalGenerator::GetDeviceLinkFlags( if (ipoEnabled) { if (cmValue cudaIPOFlags = this->Makefile->GetDefinition( "CMAKE_CUDA_DEVICE_LINK_OPTIONS_IPO")) { - linkFlags += cudaIPOFlags; + linkFlags += *cudaIPOFlags; } } @@ -1848,7 +1848,7 @@ bool cmLocalGenerator::AllAppleArchSysrootsAreTheSame( [this, sysroot](std::string const& arch) -> bool { std::string const& archSysroot = this->AppleArchSysroots[arch]; - return cmIsOff(archSysroot) || sysroot == archSysroot; + return cmIsOff(archSysroot) || *sysroot == archSysroot; }); } diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index e7a1f93..759ee7b 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -147,7 +147,7 @@ void cmLocalXCodeGenerator::AddXCConfigSources(cmGeneratorTarget* target) for (auto& config : configs) { auto file = cmGeneratorExpression::Evaluate( - xcconfig, + *xcconfig, this, config); if (!file.empty()) { target->AddSource(file); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index db8f785..d26f383 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -983,7 +983,8 @@ void cmMakefile::Generate(cmLocalGenerator& lg) this->DoGenerate(lg); cmValue oldValue = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"); if (oldValue && - cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, oldValue, "2.4")) { + cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, *oldValue, + "2.4")) { this->GetCMakeInstance()->IssueMessage( MessageType::FATAL_ERROR, "You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less " diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 44f37cb..d5f6f0d 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -179,7 +179,7 @@ void cmSearchPath::AddPrefixPaths(const std::vector& paths, cmValue arch = this->FC->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE"); if (cmNonempty(arch)) { - std::string archNoUnknown = arch; + std::string archNoUnknown = *arch; auto unknownAtPos = archNoUnknown.find("-unknown-"); bool foundUnknown = unknownAtPos != std::string::npos; if (foundUnknown) { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9734414..ce9a842 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -550,7 +550,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( e1.Element("Platform", this->Platform); cmValue projLabel = this->GeneratorTarget->GetProperty("PROJECT_LABEL"); - e1.Element("ProjectName", projLabel ? projLabel : this->Name); + e1.Element("ProjectName", projLabel ? *projLabel : this->Name); { cm::optional targetFramework; cm::optional targetFrameworkVersion; -- cgit v0.12