From 3e6058078433089f145903d25e06dafadeee9629 Mon Sep 17 00:00:00 2001 From: Regina Pfeifer Date: Wed, 21 Nov 2018 20:51:35 +0100 Subject: clang-tidy: Fix readability-static-accessed-through-instance Enable the check in .clang-tidy and fix all warnings. --- .clang-tidy | 1 - Source/CPack/IFW/cmCPackIFWPackage.cxx | 4 +- Source/CPack/cmCPackNSISGenerator.cxx | 6 +- Source/CTest/cmCTestGIT.cxx | 6 +- Source/CTest/cmCTestHG.cxx | 3 +- Source/CTest/cmCTestSVN.cxx | 6 +- Source/CTest/cmCTestScriptHandler.cxx | 4 +- Source/CTest/cmCTestStartCommand.cxx | 2 +- Source/CTest/cmCTestVC.cxx | 4 +- Source/QtDialog/AddCacheEntry.cxx | 12 ++-- Source/QtDialog/CMakeSetup.cxx | 12 ++-- Source/QtDialog/QCMakeCacheView.cxx | 4 +- Source/cmCTest.cxx | 2 +- Source/cmCacheManager.cxx | 18 ++--- Source/cmExportInstallFileGenerator.cxx | 12 ++-- Source/cmExtraEclipseCDT4Generator.cxx | 99 +++++++++++++++----------- Source/cmGlobalGenerator.cxx | 4 +- Source/cmGlobalNinjaGenerator.cxx | 8 ++- Source/cmInstallCommandArguments.cxx | 3 +- Source/cmJsonObjects.cxx | 3 +- Source/cmLocalNinjaGenerator.cxx | 7 +- Source/cmLocalUnixMakefileGenerator3.cxx | 8 +-- Source/cmMakefileTargetGenerator.cxx | 10 +-- Source/cmOutputConverter.cxx | 2 +- Source/cmQtAutoGenInitializer.cxx | 2 +- Source/cmRST.cxx | 2 +- Source/cmServer.cxx | 2 +- Source/cmServerProtocol.cxx | 2 +- Source/cmTargetLinkLibrariesCommand.cxx | 8 ++- Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in | 6 +- 30 files changed, 144 insertions(+), 118 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index cec7d03..28d6eba 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -32,7 +32,6 @@ readability-*,\ -readability-redundant-declaration,\ -readability-redundant-member-init,\ -readability-simplify-boolean-expr,\ --readability-static-accessed-through-instance,\ " HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$' ... diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 67e279c..c96b5d4 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -359,7 +359,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->DisplayName.clear(); } else if (const char* value = this->GetOption(option)) { - this->ExpandListArgument(value, this->DisplayName); + cmCPackIFWPackage::ExpandListArgument(value, this->DisplayName); } // Description @@ -367,7 +367,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->Description.clear(); } else if (const char* value = this->GetOption(option)) { - this->ExpandListArgument(value, this->Description); + cmCPackIFWPackage::ExpandListArgument(value, this->Description); } // Release date diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index f75a750..d02aa5a 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -223,7 +223,8 @@ int cmCPackNSISGenerator::PackageFiles() if (!group.second.Description.empty()) { groupDescriptions += " !insertmacro MUI_DESCRIPTION_TEXT ${" + group.first + "} \"" + - this->TranslateNewlines(group.second.Description) + "\"\n"; + cmCPackNSISGenerator::TranslateNewlines(group.second.Description) + + "\"\n"; } } @@ -253,7 +254,8 @@ int cmCPackNSISGenerator::PackageFiles() if (!comp.second.Description.empty()) { componentDescriptions += " !insertmacro MUI_DESCRIPTION_TEXT ${" + comp.first + "} \"" + - this->TranslateNewlines(comp.second.Description) + "\"\n"; + cmCPackNSISGenerator::TranslateNewlines(comp.second.Description) + + "\"\n"; } } diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 71fcafb..97c6b4f 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -618,8 +618,8 @@ bool cmCTestGIT::LoadRevisions() git, "diff-tree", "--stdin", "--always", "-z", "-r", "--pretty=raw", "--encoding=utf-8", nullptr }; - this->Log << this->ComputeCommandLine(git_rev_list) << " | " - << this->ComputeCommandLine(git_diff_tree) << "\n"; + this->Log << cmCTestGIT::ComputeCommandLine(git_rev_list) << " | " + << cmCTestGIT::ComputeCommandLine(git_diff_tree) << "\n"; cmsysProcess* cp = cmsysProcess_New(); cmsysProcess_AddCommand(cp, git_rev_list); @@ -628,7 +628,7 @@ bool cmCTestGIT::LoadRevisions() CommitParser out(this, "dt-out> "); OutputLogger err(this->Log, "dt-err> "); - this->RunProcess(cp, &out, &err, cmProcessOutput::UTF8); + cmCTestGIT::RunProcess(cp, &out, &err, cmProcessOutput::UTF8); // Send one extra zero-byte to terminate the last record. out.Process("", 1); diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index c3c5da4..9c6a80d 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -194,7 +194,8 @@ private: this->CData.clear(); if (name == "logentry") { this->Rev = Revision(); - if (const char* rev = this->FindAttribute(atts, "revision")) { + if (const char* rev = + cmCTestHG::LogParser::FindAttribute(atts, "revision")) { this->Rev.Rev = rev; } this->Changes.clear(); diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 58d9b3d..6c439e9 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -330,13 +330,15 @@ private: if (name == "logentry") { this->Rev = Revision(); this->Rev.SVNInfo = &SVNRepo; - if (const char* rev = this->FindAttribute(atts, "revision")) { + if (const char* rev = + cmCTestSVN::LogParser::FindAttribute(atts, "revision")) { this->Rev.Rev = rev; } this->Changes.clear(); } else if (name == "path") { this->CurChange = Change(); - if (const char* action = this->FindAttribute(atts, "action")) { + if (const char* action = + cmCTestSVN::LogParser::FindAttribute(atts, "action")) { this->CurChange.Action = action[0]; } } diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index a87473d..30192c2 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -760,8 +760,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard() // put the initial cache into the bin dir if (!this->InitialCache.empty()) { - if (!this->WriteInitialCache(this->BinaryDir.c_str(), - this->InitialCache.c_str())) { + if (!cmCTestScriptHandler::WriteInitialCache(this->BinaryDir.c_str(), + this->InitialCache.c_str())) { this->RestoreBackupDirectories(); return 9; } diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 47006c1..67ff2db 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -146,7 +146,7 @@ bool cmCTestStartCommand::InitialPass(std::vector const& args, this->CTest->SetSuppressUpdatingCTestConfiguration(true); int model; if (smodel) { - model = this->CTest->GetTestModelFromString(smodel); + model = cmCTest::GetTestModelFromString(smodel); } else { model = cmCTest::UNKNOWN; } diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 21c8889..63bd0e6 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -79,13 +79,13 @@ bool cmCTestVC::RunChild(char const* const* cmd, OutputParser* out, OutputParser* err, const char* workDir, Encoding encoding) { - this->Log << this->ComputeCommandLine(cmd) << "\n"; + this->Log << cmCTestVC::ComputeCommandLine(cmd) << "\n"; cmsysProcess* cp = cmsysProcess_New(); cmsysProcess_SetCommand(cp, cmd); workDir = workDir ? workDir : this->SourceDirectory.c_str(); cmsysProcess_SetWorkingDirectory(cp, workDir); - this->RunProcess(cp, out, err, encoding); + cmCTestVC::RunProcess(cp, out, err, encoding); int result = cmsysProcess_GetExitValue(cp); cmsysProcess_Delete(cp); return result == 0; diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx index 70610d7..f5e0777 100644 --- a/Source/QtDialog/AddCacheEntry.cxx +++ b/Source/QtDialog/AddCacheEntry.cxx @@ -32,12 +32,12 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames, this->StackedWidget->addWidget(path); this->StackedWidget->addWidget(filepath); this->StackedWidget->addWidget(string); - this->setTabOrder(this->Name, this->Type); - this->setTabOrder(this->Type, cb); - this->setTabOrder(cb, path); - this->setTabOrder(path, filepath); - this->setTabOrder(filepath, string); - this->setTabOrder(string, this->Description); + AddCacheEntry::setTabOrder(this->Name, this->Type); + AddCacheEntry::setTabOrder(this->Type, cb); + AddCacheEntry::setTabOrder(cb, path); + AddCacheEntry::setTabOrder(path, filepath); + AddCacheEntry::setTabOrder(filepath, string); + AddCacheEntry::setTabOrder(string, this->Description); QCompleter* completer = new QCompleter(this->VarNames, this); this->Name->setCompleter(completer); connect(completer, SIGNAL(activated(const QString&)), this, diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 7b980a0..697e4c0 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -130,15 +130,15 @@ int main(int argc, char** argv) QTranslator translator; QString transfile = QString("cmake_%1").arg(QLocale::system().name()); translator.load(transfile, translationsDir.path()); - app.installTranslator(&translator); + QApplication::installTranslator(&translator); // app setup - app.setApplicationName("CMakeSetup"); - app.setOrganizationName("Kitware"); + QApplication::setApplicationName("CMakeSetup"); + QApplication::setOrganizationName("Kitware"); QIcon appIcon; appIcon.addFile(":/Icons/CMakeSetup32.png"); appIcon.addFile(":/Icons/CMakeSetup128.png"); - app.setWindowIcon(appIcon); + QApplication::setWindowIcon(appIcon); CMakeSetupDialog dialog; dialog.show(); @@ -159,7 +159,7 @@ int main(int argc, char** argv) dialog.setSourceDirectory(QString::fromLocal8Bit(sourceDirectory.c_str())); dialog.setBinaryDirectory(QString::fromLocal8Bit(binaryDirectory.c_str())); } else { - QStringList args = app.arguments(); + QStringList args = QApplication::arguments(); if (args.count() == 2) { std::string filePath = cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data()); @@ -189,7 +189,7 @@ int main(int argc, char** argv) } } - return app.exec(); + return QApplication::exec(); } #if defined(Q_OS_MAC) diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 7d3aa57..821c3f4 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -248,9 +248,9 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) } } else if (this->View == GroupView) { QMap newPropsTree; - this->breakProperties(newProps, newPropsTree); + QCMakeCacheModel::breakProperties(newProps, newPropsTree); QMap newPropsTree2; - this->breakProperties(newProps2, newPropsTree2); + QCMakeCacheModel::breakProperties(newProps2, newPropsTree2); QStandardItem* root = this->invisibleRootItem(); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index c2b6575..13c06a7 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -296,7 +296,7 @@ cmCTest::cmCTest() this->DropSiteCDash = false; this->BuildID = ""; this->OutputTestOutputOnTestFailure = false; - this->OutputColorCode = this->ColoredOutputSupportedByConsole(); + this->OutputColorCode = cmCTest::ColoredOutputSupportedByConsole(); this->RepeatTests = 1; // default to run each test once this->RepeatUntilFail = false; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 0305677..6ccb3a8 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -188,7 +188,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, } const char* end = entryKey.c_str() + entryKey.size(); - for (const char** p = this->PersistentProperties; *p; ++p) { + for (const char** p = cmCacheManager::PersistentProperties; *p; ++p) { std::string::size_type plen = strlen(*p) + 1; if (entryKey.size() > plen && *(end - plen) == '-' && strcmp(end - plen + 1, *p) == 0) { @@ -212,7 +212,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, void cmCacheManager::WritePropertyEntries(std::ostream& os, CacheIterator i, cmMessenger* messenger) { - for (const char** p = this->PersistentProperties; *p; ++p) { + for (const char** p = cmCacheManager::PersistentProperties; *p; ++p) { if (const char* value = i.GetProperty(*p)) { std::string helpstring = *p; helpstring += " property for variable: "; @@ -222,9 +222,9 @@ void cmCacheManager::WritePropertyEntries(std::ostream& os, CacheIterator i, std::string key = i.GetName(); key += "-"; key += *p; - this->OutputKey(os, key); + cmCacheManager::OutputKey(os, key); os << ":INTERNAL="; - this->OutputValue(os, value); + cmCacheManager::OutputValue(os, value); os << "\n"; cmCacheManager::OutputNewlineTruncationWarning(os, key, value, messenger); @@ -319,9 +319,9 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) } else { cmCacheManager::OutputHelpString(fout, "Missing description"); } - this->OutputKey(fout, i.first); + cmCacheManager::OutputKey(fout, i.first); fout << ":" << cmState::CacheEntryTypeToString(t) << "="; - this->OutputValue(fout, ce.Value); + cmCacheManager::OutputValue(fout, ce.Value); fout << "\n"; cmCacheManager::OutputNewlineTruncationWarning(fout, i.first, ce.Value, messenger); @@ -346,11 +346,11 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) if (t == cmStateEnums::INTERNAL) { // Format is key:type=value if (const char* help = i.GetProperty("HELPSTRING")) { - this->OutputHelpString(fout, help); + cmCacheManager::OutputHelpString(fout, help); } - this->OutputKey(fout, i.GetName()); + cmCacheManager::OutputKey(fout, i.GetName()); fout << ":" << cmState::CacheEntryTypeToString(t) << "="; - this->OutputValue(fout, i.GetValue()); + cmCacheManager::OutputValue(fout, i.GetValue()); fout << "\n"; cmCacheManager::OutputNewlineTruncationWarning(fout, i.GetName(), i.GetValue(), messenger); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index e444087..93115b6 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -397,8 +397,8 @@ void cmExportInstallFileGenerator::SetImportLocationProperty( prop += suffix; // Append the installed file name. - value += itgen->GetInstallFilename(target, config, - cmInstallTargetGenerator::NameImplib); + value += cmInstallTargetGenerator::GetInstallFilename( + target, config, cmInstallTargetGenerator::NameImplib); // Store the property. properties[prop] = value; @@ -426,12 +426,12 @@ void cmExportInstallFileGenerator::SetImportLocationProperty( // Append the installed file name. if (target->IsAppBundleOnApple()) { - value += itgen->GetInstallFilename(target, config); + value += cmInstallTargetGenerator::GetInstallFilename(target, config); value += ".app/Contents/MacOS/"; - value += itgen->GetInstallFilename(target, config); + value += cmInstallTargetGenerator::GetInstallFilename(target, config); } else { - value += itgen->GetInstallFilename(target, config, - cmInstallTargetGenerator::NameReal); + value += cmInstallTargetGenerator::GetInstallFilename( + target, config, cmInstallTargetGenerator::NameReal); } // Store the property. diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 87ee382..8e25e9c 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -171,9 +171,9 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() // set up the project name: -Source@ cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0]; - std::string name = - this->GenerateProjectName(lg->GetProjectName(), "Source", - this->GetPathBasename(this->HomeDirectory)); + std::string name = cmExtraEclipseCDT4Generator::GenerateProjectName( + lg->GetProjectName(), "Source", + cmExtraEclipseCDT4Generator::GetPathBasename(this->HomeDirectory)); const std::string filename = this->HomeDirectory + "/.project"; cmGeneratedFileStream fout(filename); @@ -278,10 +278,11 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() xml.StartElement("projectDescription"); xml.Element("name", - this->GenerateProjectName( + cmExtraEclipseCDT4Generator::GenerateProjectName( lg->GetProjectName(), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), - this->GetPathBasename(this->HomeOutputDirectory))); + cmExtraEclipseCDT4Generator::GetPathBasename( + this->HomeOutputDirectory))); xml.Element("comment", ""); xml.Element("projects", ""); @@ -302,16 +303,17 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() // set the make command AppendDictionary(xml, "org.eclipse.cdt.make.core.enabledIncrementalBuild", "true"); - AppendDictionary( - xml, "org.eclipse.cdt.make.core.build.command", - this->GetEclipsePath(mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"))); + AppendDictionary(xml, "org.eclipse.cdt.make.core.build.command", + cmExtraEclipseCDT4Generator::GetEclipsePath( + mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"))); AppendDictionary(xml, "org.eclipse.cdt.make.core.contents", "org.eclipse.cdt.make.core.activeConfigSettings"); AppendDictionary(xml, "org.eclipse.cdt.make.core.build.target.inc", "all"); AppendDictionary(xml, "org.eclipse.cdt.make.core.build.arguments", mf->GetSafeDefinition("CMAKE_ECLIPSE_MAKE_ARGUMENTS")); - AppendDictionary(xml, "org.eclipse.cdt.make.core.buildLocation", - this->GetEclipsePath(this->HomeOutputDirectory)); + AppendDictionary( + xml, "org.eclipse.cdt.make.core.buildLocation", + cmExtraEclipseCDT4Generator::GetEclipsePath(this->HomeOutputDirectory)); AppendDictionary(xml, "org.eclipse.cdt.make.core.useDefaultBuildCmd", "false"); @@ -341,8 +343,9 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() "clean"); AppendDictionary(xml, "org.eclipse.cdt.make.core.fullBuildTarget", "all"); AppendDictionary(xml, "org.eclipse.cdt.make.core.buildArguments", ""); - AppendDictionary(xml, "org.eclipse.cdt.make.core.build.location", - this->GetEclipsePath(this->HomeOutputDirectory)); + AppendDictionary( + xml, "org.eclipse.cdt.make.core.build.location", + cmExtraEclipseCDT4Generator::GetEclipsePath(this->HomeOutputDirectory)); AppendDictionary(xml, "org.eclipse.cdt.make.core.autoBuildTarget", "all"); // set error parsers @@ -407,13 +410,15 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() std::string sourceLinkedResourceName = "[Source directory]"; std::string linkSourceDirectory = - this->GetEclipsePath(lg->GetCurrentSourceDirectory()); + cmExtraEclipseCDT4Generator::GetEclipsePath( + lg->GetCurrentSourceDirectory()); // .project dir can't be subdir of a linked resource dir if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory, linkSourceDirectory)) { - this->AppendLinkedResource(xml, sourceLinkedResourceName, - this->GetEclipsePath(linkSourceDirectory), - LinkToFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, sourceLinkedResourceName, + cmExtraEclipseCDT4Generator::GetEclipsePath(linkSourceDirectory), + LinkToFolder); this->SrcLinkedResources.push_back(std::move(sourceLinkedResourceName)); } } @@ -439,8 +444,8 @@ void cmExtraEclipseCDT4Generator::WriteGroups( std::replace(linkName3.begin(), linkName3.end(), '\\', '/'); - this->AppendLinkedResource(xml, linkName3, "virtual:/virtual", - VirtualFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, linkName3, "virtual:/virtual", VirtualFolder); std::vector const& children = sg.GetGroupChildren(); if (!children.empty()) { this->WriteGroups(children, linkName, xml); @@ -453,8 +458,9 @@ void cmExtraEclipseCDT4Generator::WriteGroups( std::string linkName4 = linkName3; linkName4 += "/"; linkName4 += cmSystemTools::GetFilenameName(fullPath); - this->AppendLinkedResource(xml, linkName4, - this->GetEclipsePath(fullPath), LinkToFile); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, linkName4, + cmExtraEclipseCDT4Generator::GetEclipsePath(fullPath), LinkToFile); } } } @@ -463,7 +469,8 @@ void cmExtraEclipseCDT4Generator::WriteGroups( void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) { std::string linkName = "[Targets]"; - this->AppendLinkedResource(xml, linkName, "virtual:/virtual", VirtualFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, linkName, "virtual:/virtual", VirtualFolder); for (cmLocalGenerator* lg : this->GlobalGenerator->GetLocalGenerators()) { cmMakefile* makefile = lg->GetMakefile(); @@ -483,8 +490,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) : "[lib] "); linkName2 += prefix; linkName2 += target->GetName(); - this->AppendLinkedResource(xml, linkName2, "virtual:/virtual", - VirtualFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, linkName2, "virtual:/virtual", VirtualFolder); if (!this->GenerateLinkedResources) { break; // skip generating the linked resources to the source files } @@ -522,21 +529,23 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( // for each sub project create a linked resource to the source dir // - only if it is an out-of-source build - this->AppendLinkedResource(xml, "[Subprojects]", "virtual:/virtual", - VirtualFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, "[Subprojects]", "virtual:/virtual", VirtualFolder); for (auto const& it : this->GlobalGenerator->GetProjectMap()) { std::string linkSourceDirectory = - this->GetEclipsePath(it.second[0]->GetCurrentSourceDirectory()); + cmExtraEclipseCDT4Generator::GetEclipsePath( + it.second[0]->GetCurrentSourceDirectory()); // a linked resource must not point to a parent directory of .project or // .project itself if ((baseDir != linkSourceDirectory) && !cmSystemTools::IsSubDirectory(baseDir, linkSourceDirectory)) { std::string linkName = "[Subprojects]/"; linkName += it.first; - this->AppendLinkedResource(xml, linkName, - this->GetEclipsePath(linkSourceDirectory), - LinkToFolder); + cmExtraEclipseCDT4Generator::AppendLinkedResource( + xml, linkName, + cmExtraEclipseCDT4Generator::GetEclipsePath(linkSourceDirectory), + LinkToFolder); // Don't add it to the srcLinkedResources, because listing multiple // directories confuses the Eclipse indexer (#13596). } @@ -903,7 +912,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs if (subdir.empty()) { - this->AppendTarget(xml, targetName, make, makeArgs, subdir, ": "); + cmExtraEclipseCDT4Generator::AppendTarget(xml, targetName, make, + makeArgs, subdir, ": "); } } break; case cmStateEnums::UTILITY: @@ -918,7 +928,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const break; } - this->AppendTarget(xml, targetName, make, makeArgs, subdir, ": "); + cmExtraEclipseCDT4Generator::AppendTarget(xml, targetName, make, + makeArgs, subdir, ": "); break; case cmStateEnums::EXECUTABLE: case cmStateEnums::STATIC_LIBRARY: @@ -928,10 +939,12 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const const char* prefix = (target->GetType() == cmStateEnums::EXECUTABLE ? "[exe] " : "[lib] "); - this->AppendTarget(xml, targetName, make, makeArgs, subdir, prefix); + cmExtraEclipseCDT4Generator::AppendTarget(xml, targetName, make, + makeArgs, subdir, prefix); std::string fastTarget = targetName; fastTarget += "/fast"; - this->AppendTarget(xml, fastTarget, make, makeArgs, subdir, prefix); + cmExtraEclipseCDT4Generator::AppendTarget(xml, fastTarget, make, + makeArgs, subdir, prefix); // Add Build and Clean targets in the virtual folder of targets: if (this->SupportsVirtualFolders) { @@ -942,8 +955,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const buildArgs += lgen->GetBinaryDirectory(); buildArgs += "\" "; buildArgs += makeArgs; - this->AppendTarget(xml, "Build", make, buildArgs, virtDir, "", - targetName.c_str()); + cmExtraEclipseCDT4Generator::AppendTarget( + xml, "Build", make, buildArgs, virtDir, "", targetName.c_str()); std::string cleanArgs = "-E chdir \""; cleanArgs += lgen->GetCurrentBinaryDirectory(); @@ -953,8 +966,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const cmGeneratorTarget* gt = target; cleanArgs += lgen->GetTargetDirectory(gt); cleanArgs += "/cmake_clean.cmake\""; - this->AppendTarget(xml, "Clean", cmSystemTools::GetCMakeCommand(), - cleanArgs, virtDir, "", ""); + cmExtraEclipseCDT4Generator::AppendTarget( + xml, "Clean", cmSystemTools::GetCMakeCommand(), cleanArgs, + virtDir, "", ""); } } break; default: @@ -964,10 +978,12 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // insert the all and clean targets in every subdir if (!allTarget.empty()) { - this->AppendTarget(xml, allTarget, make, makeArgs, subdir, ": "); + cmExtraEclipseCDT4Generator::AppendTarget(xml, allTarget, make, makeArgs, + subdir, ": "); } if (!cleanTarget.empty()) { - this->AppendTarget(xml, cleanTarget, make, makeArgs, subdir, ": "); + cmExtraEclipseCDT4Generator::AppendTarget(xml, cleanTarget, make, + makeArgs, subdir, ": "); } // insert rules for compiling, preprocessing and assembling individual @@ -981,14 +997,15 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } else if (f.back() == 'i') { prefix = "[pre] "; } - this->AppendTarget(xml, f, make, makeArgs, subdir, prefix); + cmExtraEclipseCDT4Generator::AppendTarget(xml, f, make, makeArgs, subdir, + prefix); } } xml.EndElement(); // buildTargets xml.EndElement(); // storageModule - this->AppendStorageScanners(xml, *mf); + cmExtraEclipseCDT4Generator::AppendStorageScanners(xml, *mf); xml.EndElement(); // cconfiguration xml.EndElement(); // storageModule diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2805395..8b20db6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1204,7 +1204,7 @@ void cmGlobalGenerator::Configure() const char* logs[] = { "CMakeOutput.log", "CMakeError.log", nullptr }; for (const char** log = logs; *log; ++log) { std::string f = this->CMakeInstance->GetHomeOutputDirectory(); - f += this->CMakeInstance->GetCMakeFilesDirectory(); + f += cmake::GetCMakeFilesDirectory(); f += "/"; f += *log; if (cmSystemTools::FileExists(f)) { @@ -2808,7 +2808,7 @@ void cmGlobalGenerator::CheckRuleHashes() #if defined(CMAKE_BUILD_WITH_CMAKE) std::string home = this->GetCMakeInstance()->GetHomeOutputDirectory(); std::string pfile = home; - pfile += this->GetCMakeInstance()->GetCMakeFilesDirectory(); + pfile += cmake::GetCMakeFilesDirectory(); pfile += "/CMakeRuleHashes.txt"; this->CheckRuleHashes(pfile, home); this->WriteRuleHashes(pfile); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 0271b6f..5316b19 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -503,7 +503,7 @@ void cmGlobalNinjaGenerator::Generate() std::ostringstream msg; msg << "The detected version of Ninja (" << this->NinjaVersion; msg << ") is less than the version of Ninja required by CMake ("; - msg << this->RequiredNinjaVersion() << ")."; + msg << cmGlobalNinjaGenerator::RequiredNinjaVersion() << ")."; this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, msg.str()); return; } @@ -577,7 +577,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures() RequiredNinjaVersionForConsolePool().c_str()); this->NinjaSupportsImplicitOuts = !cmSystemTools::VersionCompare( cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), - this->RequiredNinjaVersionForImplicitOuts().c_str()); + cmGlobalNinjaGenerator::RequiredNinjaVersionForImplicitOuts().c_str()); this->NinjaSupportsManifestRestat = !cmSystemTools::VersionCompare( cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), RequiredNinjaVersionForManifestRestat().c_str()); @@ -1425,7 +1425,9 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) << "is less than the version of Ninja required by CMake for adding " "restat dependencies to the build.ninja manifest regeneration " "target:\n" - << " " << this->RequiredNinjaVersionForManifestRestat() << "\n"; + << " " + << cmGlobalNinjaGenerator::RequiredNinjaVersionForManifestRestat() + << "\n"; msg << "Any pre-check scripts, such as those generated for file(GLOB " "CONFIGURE_DEPENDS), will not be run by Ninja."; this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 63bdb00..06eb8a6 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -183,7 +183,8 @@ bool cmInstallCommandArguments::CheckPermissions() { this->PermissionsString.clear(); for (std::string const& perm : this->Permissions.GetVector()) { - if (!this->CheckPermissions(perm, this->PermissionsString)) { + if (!cmInstallCommandArguments::CheckPermissions( + perm, this->PermissionsString)) { return false; } } diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx index 4148894..bc50f9f 100644 --- a/Source/cmJsonObjects.cxx +++ b/Source/cmJsonObjects.cxx @@ -450,10 +450,9 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, const std::string& config) { cmLocalGenerator* lg = target->GetLocalGenerator(); - const cmState* state = lg->GetState(); const cmStateEnums::TargetType type = target->GetType(); - const std::string typeName = state->GetTargetTypeName(type); + const std::string typeName = cmState::GetTargetTypeName(type); Json::Value ttl = Json::arrayValue; ttl.append("EXECUTABLE"); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 66edc91..8a07516 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -188,13 +188,12 @@ void cmLocalNinjaGenerator::WriteProjectHeader(std::ostream& os) void cmLocalNinjaGenerator::WriteNinjaRequiredVersion(std::ostream& os) { // Default required version - std::string requiredVersion = - this->GetGlobalNinjaGenerator()->RequiredNinjaVersion(); + std::string requiredVersion = cmGlobalNinjaGenerator::RequiredNinjaVersion(); // Ninja generator uses the 'console' pool if available (>= 1.5) if (this->GetGlobalNinjaGenerator()->SupportsConsolePool()) { requiredVersion = - this->GetGlobalNinjaGenerator()->RequiredNinjaVersionForConsolePool(); + cmGlobalNinjaGenerator::RequiredNinjaVersionForConsolePool(); } // The Ninja generator writes rules which require support for restat @@ -204,7 +203,7 @@ void cmLocalNinjaGenerator::WriteNinjaRequiredVersion(std::ostream& os) !this->GetGlobalNinjaGenerator()->GlobalSettingIsOn( "CMAKE_SUPPRESS_REGENERATION")) { requiredVersion = - this->GetGlobalNinjaGenerator()->RequiredNinjaVersionForManifestRestat(); + cmGlobalNinjaGenerator::RequiredNinjaVersionForManifestRestat(); } cmGlobalNinjaGenerator::WriteComment( diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 6a535c1..11d3608 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -470,12 +470,12 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() << "# The C and CXX include file regular expressions for " << "this directory.\n"; infoFileStream << "set(CMAKE_C_INCLUDE_REGEX_SCAN "; - this->WriteCMakeArgument(infoFileStream, - this->Makefile->GetIncludeRegularExpression()); + cmLocalUnixMakefileGenerator3::WriteCMakeArgument( + infoFileStream, this->Makefile->GetIncludeRegularExpression()); infoFileStream << ")\n"; infoFileStream << "set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "; - this->WriteCMakeArgument(infoFileStream, - this->Makefile->GetComplainRegularExpression()); + cmLocalUnixMakefileGenerator3::WriteCMakeArgument( + infoFileStream, this->Makefile->GetComplainRegularExpression()); infoFileStream << ")\n"; infoFileStream << "set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 9acae49..a79425e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1236,8 +1236,9 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( } for (std::string const& obj : this->Objects) { *this->BuildFileStream << " " << lineContinue << "\n"; - *this->BuildFileStream << this->LocalGenerator->ConvertToQuotedOutputPath( - obj.c_str(), useWatcomQuote); + *this->BuildFileStream + << cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( + obj.c_str(), useWatcomQuote); } *this->BuildFileStream << "\n"; @@ -1258,8 +1259,9 @@ void cmMakefileTargetGenerator::WriteObjectsVariable( object = this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, obj); *this->BuildFileStream << " " << lineContinue << "\n"; - *this->BuildFileStream << this->LocalGenerator->ConvertToQuotedOutputPath( - obj.c_str(), useWatcomQuote); + *this->BuildFileStream + << cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( + obj.c_str(), useWatcomQuote); } *this->BuildFileStream << "\n" << "\n"; diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 43a0107..80e6e97 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -111,7 +111,7 @@ std::string cmOutputConverter::ConvertToRelativePath( return remote_path; } - return this->ForceToRelativePath(local_path, remote_path); + return cmOutputConverter::ForceToRelativePath(local_path, remote_path); } std::string cmOutputConverter::ForceToRelativePath( diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index e71feac..d64b54b 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -334,7 +334,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Info directory this->Dir.Info = cbd; - this->Dir.Info += makefile->GetCMakeInstance()->GetCMakeFilesDirectory(); + this->Dir.Info += cmake::GetCMakeFilesDirectory(); this->Dir.Info += '/'; this->Dir.Info += this->Target->GetName(); this->Dir.Info += "_autogen"; diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 8a04c1f..f0f92aa 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -122,7 +122,7 @@ void cmRST::ProcessModule(std::istream& is) void cmRST::Reset() { if (!this->MarkupLines.empty()) { - this->UnindentLines(this->MarkupLines); + cmRST::UnindentLines(this->MarkupLines); } switch (this->Directive) { case DirectiveNone: diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index f15a14a..fe0bdc9 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -216,7 +216,7 @@ cmServerResponse cmServer::SetProtocolVersion(const cmServerRequest& request) } this->Protocol = - this->FindMatchingProtocol(this->SupportedProtocols, major, minor); + cmServer::FindMatchingProtocol(this->SupportedProtocols, major, minor); if (!this->Protocol) { return request.ReportError("Protocol version not supported."); } diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index f051fd9..6dbfd10 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -244,7 +244,7 @@ bool cmServerProtocol1::DoActivate(const cmServerRequest& request, return false; } - const std::string cachePath = cm->FindCacheFile(buildDirectory); + const std::string cachePath = cmake::FindCacheFile(buildDirectory); if (cm->LoadCache(cachePath)) { cmState* state = cm->GetState(); diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index ad33f98..66cc6ee 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -256,7 +256,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( // Make sure the last argument was not a library type specifier. if (haveLLT) { std::ostringstream e; - e << "The \"" << this->LinkLibraryTypeNames[llt] + e << "The \"" << cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[llt] << "\" argument must be followed by a library."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); @@ -284,8 +284,10 @@ void cmTargetLinkLibrariesCommand::LinkLibraryTypeSpecifierWarning(int left, int right) { std::ostringstream w; - w << "Link library type specifier \"" << this->LinkLibraryTypeNames[left] - << "\" is followed by specifier \"" << this->LinkLibraryTypeNames[right] + w << "Link library type specifier \"" + << cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[left] + << "\" is followed by specifier \"" + << cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[right] << "\" instead of a library name. " << "The first specifier will be ignored."; this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); diff --git a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in index b4c6fae4..3183bc0 100644 --- a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in +++ b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in @@ -15,15 +15,15 @@ int main(int ac, char** av) std::string logarg; bool nextarg = false; - if (exename.find("valgrind") != exename.npos) { + if (exename.find("valgrind") != std::string::npos) { logarg = "--log-file="; - } else if (exename.find("purify") != exename.npos) { + } else if (exename.find("purify") != std::string::npos) { #ifdef _WIN32 logarg = "/SAVETEXTDATA="; #else logarg = "-log-file="; #endif - } else if (exename.find("BC") != exename.npos) { + } else if (exename.find("BC") != std::string::npos) { nextarg = true; logarg = "/X"; } -- cgit v0.12