diff options
author | Brad King <brad.king@kitware.com> | 2019-08-22 14:23:24 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-08-22 14:23:34 (GMT) |
commit | 337be1507d0850c1d83de0f9ad87a780c9cb61af (patch) | |
tree | 8f6e685341766cc429b5120a1a120bbfaf9bbaea /Source | |
parent | 6e1ff50efbc49628e7f9575b57128c0829bf607c (diff) | |
parent | d331021255ba9092fa34e8e479d724b1092c704d (diff) | |
download | CMake-337be1507d0850c1d83de0f9ad87a780c9cb61af.zip CMake-337be1507d0850c1d83de0f9ad87a780c9cb61af.tar.gz CMake-337be1507d0850c1d83de0f9ad87a780c9cb61af.tar.bz2 |
Merge topic 'isolate-declarations'
d331021255 clang-tidy: isolate declarations for readability
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3704
Diffstat (limited to 'Source')
25 files changed, 102 insertions, 48 deletions
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 7caed0c..ce32898 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -56,7 +56,8 @@ void onsig(int /*unused*/) cbreak(); /* nl- or cr not needed */ keypad(stdscr, true); /* Use key symbols as KEY_DOWN */ refresh(); - int x, y; + int x; + int y; getmaxyx(stdscr, y, x); cmCursesForm::CurrentForm->Render(1, 1, x, y); cmCursesForm::CurrentForm->UpdateStatusBar(); @@ -127,7 +128,8 @@ int main(int argc, char const* const* argv) signal(SIGWINCH, onsig); - int x, y; + int x; + int y; getmaxyx(stdscr, y, x); if (x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT) { endwin(); diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 4e887d6..95026d5 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -38,7 +38,8 @@ cmCursesLongMessageForm::~cmCursesLongMessageForm() void cmCursesLongMessageForm::UpdateStatusBar() { - int x, y; + int x; + int y; getmaxyx(stdscr, y, x); char bar[cmCursesMainForm::MAX_WIDTH]; @@ -81,7 +82,8 @@ void cmCursesLongMessageForm::UpdateStatusBar() void cmCursesLongMessageForm::PrintKeys() { - int x, y; + int x; + int y; getmaxyx(stdscr, y, x); if (x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT) { return; @@ -98,7 +100,8 @@ void cmCursesLongMessageForm::PrintKeys() void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/, int /*height*/) { - int x, y; + int x; + int y; getmaxyx(stdscr, y, x); if (this->Form) { diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 9ac80b8..9115a3b 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -320,7 +320,8 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) void cmCursesMainForm::PrintKeys(int process /* = 0 */) { - int x, y; + int x; + int y; getmaxyx(stdscr, y, x); if (x < cmCursesMainForm::MIN_WIDTH || x < this->InitialWidth || y < cmCursesMainForm::MIN_HEIGHT) { @@ -391,7 +392,8 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) // on the status bar. Designed for a width of 80 chars. void cmCursesMainForm::UpdateStatusBar(const char* message) { - int x, y; + int x; + int y; getmaxyx(stdscr, y, x); // If window size is too small, display error and return if (x < cmCursesMainForm::MIN_WIDTH || x < this->InitialWidth || @@ -509,7 +511,8 @@ void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog) int cmCursesMainForm::Configure(int noconfigure) { - int xi, yi; + int xi; + int yi; getmaxyx(stdscr, yi, xi); curses_move(1, 1); @@ -552,7 +555,8 @@ int cmCursesMainForm::Configure(int noconfigure) if (cmSystemTools::GetErrorOccuredFlag()) { this->OkToGenerate = false; } - int xx, yy; + int xx; + int yy; getmaxyx(stdscr, yy, xx); cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(this->Errors, @@ -581,7 +585,8 @@ int cmCursesMainForm::Configure(int noconfigure) int cmCursesMainForm::Generate() { - int xi, yi; + int xi; + int yi; getmaxyx(stdscr, yi, xi); curses_move(1, 1); @@ -610,7 +615,8 @@ int cmCursesMainForm::Generate() } // reset error condition cmSystemTools::ResetErrorOccuredFlag(); - int xx, yy; + int xx; + int yy; getmaxyx(stdscr, yy, xx); const char* title = "Messages during last pass."; if (cmSystemTools::GetErrorOccuredFlag()) { @@ -707,7 +713,8 @@ void cmCursesMainForm::FixValue(cmStateEnums::CacheEntryType type, void cmCursesMainForm::HandleInput() { - int x = 0, y = 0; + int x = 0; + int y = 0; if (!this->Form) { return; diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index 5e2a329..26724e7 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -64,7 +64,8 @@ void cmCursesStringWidget::OnType(int& key, cmCursesMainForm* fm, bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) { - int x, y; + int x; + int y; FORM* form = fm->GetForm(); // when not in edit mode, edit mode is entered by pressing enter or i (vim @@ -179,7 +180,8 @@ const char* cmCursesStringWidget::GetValue() bool cmCursesStringWidget::PrintKeys() { - int x, y; + int x; + int y; getmaxyx(stdscr, y, x); if (x < cmCursesMainForm::MIN_WIDTH || y < cmCursesMainForm::MIN_HEIGHT) { return false; diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 78a2710..5e8636a 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -210,7 +210,8 @@ void QCMakeCacheModel::clear() void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) { - QSet<QCMakeProperty> newProps, newProps2; + QSet<QCMakeProperty> newProps; + QSet<QCMakeProperty> newProps2; if (this->ShowNewProperties) { newProps = props.toSet(); diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index e502a64..11d28c2 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -33,10 +33,18 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args, } cmMakefile& mf = status.GetMakefile(); - std::string source, target, main_dependency, working, depfile, job_pool; + std::string source; + std::string target; + std::string main_dependency; + std::string working; + std::string depfile; + std::string job_pool; std::string comment_buffer; const char* comment = nullptr; - std::vector<std::string> depends, outputs, output, byproducts; + std::vector<std::string> depends; + std::vector<std::string> outputs; + std::vector<std::string> output; + std::vector<std::string> byproducts; bool verbatim = false; bool append = false; bool uses_terminal = false; diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index f812ab5..c14b745 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -43,7 +43,8 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args, cmCustomCommandLines commandLines; // Accumulate dependencies. - std::vector<std::string> depends, byproducts; + std::vector<std::string> depends; + std::vector<std::string> byproducts; std::string working_directory; bool verbatim = false; bool uses_terminal = false; diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx index 0c73ac8..7ff8584 100644 --- a/Source/cmBinUtilsMacOSMachOLinker.cxx +++ b/Source/cmBinUtilsMacOSMachOLinker.cxx @@ -59,7 +59,8 @@ bool cmBinUtilsMacOSMachOLinker::ScanDependencies( bool cmBinUtilsMacOSMachOLinker::ScanDependencies( std::string const& file, std::string const& executablePath) { - std::vector<std::string> libs, rpaths; + std::vector<std::string> libs; + std::vector<std::string> rpaths; if (!this->Tool->GetFileInfo(file, libs, rpaths)) { return false; } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4f7eaea..9867f16 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2759,7 +2759,9 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args, return false; } - std::vector<std::string> deps, unresolvedDeps, conflictingDeps; + std::vector<std::string> deps; + std::vector<std::string> unresolvedDeps; + std::vector<std::string> conflictingDeps; for (auto const& val : archive.GetResolvedPaths()) { bool unique = true; auto it = val.second.begin(); diff --git a/Source/cmFileTimeCache.cxx b/Source/cmFileTimeCache.cxx index 24d6bf6..0d1dae5 100644 --- a/Source/cmFileTimeCache.cxx +++ b/Source/cmFileTimeCache.cxx @@ -38,7 +38,8 @@ bool cmFileTimeCache::Compare(std::string const& f1, std::string const& f2, int* result) { // Get the modification time for each file. - cmFileTime ft1, ft2; + cmFileTime ft1; + cmFileTime ft2; if (this->Load(f1, ft1) && this->Load(f2, ft2)) { // Compare the two modification times. *result = ft1.Compare(ft2); @@ -52,7 +53,8 @@ bool cmFileTimeCache::Compare(std::string const& f1, std::string const& f2, bool cmFileTimeCache::DifferS(std::string const& f1, std::string const& f2) { // Get the modification time for each file. - cmFileTime ft1, ft2; + cmFileTime ft1; + cmFileTime ft2; if (this->Load(f1, ft1) && this->Load(f2, ft2)) { // Compare the two modification times. return ft1.DifferS(ft2); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 8cd8858..f181132 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -275,7 +275,8 @@ static const struct InListNode : public cmGeneratorExpressionNode const GeneratorExpressionContent* /*content*/, cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { - std::vector<std::string> values, checkValues; + std::vector<std::string> values; + std::vector<std::string> checkValues; bool check = false; switch (context->LG->GetPolicyStatus(cmPolicies::CMP0085)) { case cmPolicies::WARN: @@ -344,7 +345,8 @@ static const struct FilterNode : public cmGeneratorExpressionNode return {}; } - std::vector<std::string> values, result; + std::vector<std::string> values; + std::vector<std::string> result; cmExpandList(parameters.front(), values, true); std::copy_if(values.cbegin(), values.cend(), std::back_inserter(result), @@ -1105,7 +1107,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); cmGeneratorTarget const* target = nullptr; - std::string targetName, propertyName; + std::string targetName; + std::string propertyName; if (parameters.size() == 2) { targetName = parameters[0]; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index fd16dbf..e62b692 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -526,7 +526,9 @@ std::string cmGeneratorTarget::GetFilePrefix( return prefix ? prefix : std::string(); } - std::string prefix, suffix, base; + std::string prefix; + std::string suffix; + std::string base; this->GetFullNameInternal(config, artifact, prefix, base, suffix); return prefix; } @@ -539,7 +541,9 @@ std::string cmGeneratorTarget::GetFileSuffix( return suffix ? suffix : std::string(); } - std::string prefix, suffix, base; + std::string prefix; + std::string suffix; + std::string base; this->GetFullNameInternal(config, artifact, prefix, base, suffix); return suffix; } diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 7d0ef83..cae8136 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -74,7 +74,8 @@ std::map<std::string, LinkLibraryScopeType> getScopedLinkLibrariesFromTarget( { char sep = ';'; std::map<std::string, LinkLibraryScopeType> tokens; - size_t start = 0, end = 0; + size_t start = 0; + size_t end = 0; const char* pInterfaceLinkLibraries = Target->GetProperty("INTERFACE_LINK_LIBRARIES"); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index ed1c80a..7bc9fdf 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -688,7 +688,8 @@ void cmInstallTargetGenerator::AddChrpathPatchRule( std::string installNameTool = mf->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL"); - std::vector<std::string> oldRuntimeDirs, newRuntimeDirs; + std::vector<std::string> oldRuntimeDirs; + std::vector<std::string> newRuntimeDirs; cli->GetRPath(oldRuntimeDirs, false); cli->GetRPath(newRuntimeDirs, true); diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 9a6653f..aed54ea 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -695,7 +695,8 @@ public: } this->Indexes.resize(size); - auto start = this->Start, step = this->Step; + auto start = this->Start; + auto step = this->Step; std::generate(this->Indexes.begin(), this->Indexes.end(), [&start, step]() -> int { auto r = start; @@ -919,8 +920,10 @@ bool cmListCommand::HandleTransformCommand( } } - const std::string REGEX{ "REGEX" }, AT{ "AT" }, FOR{ "FOR" }, - OUTPUT_VARIABLE{ "OUTPUT_VARIABLE" }; + const std::string REGEX{ "REGEX" }; + const std::string AT{ "AT" }; + const std::string FOR{ "FOR" }; + const std::string OUTPUT_VARIABLE{ "OUTPUT_VARIABLE" }; // handle optional arguments while (args.size() > index) { @@ -997,7 +1000,9 @@ bool cmListCommand::HandleTransformCommand( return false; } - int start = 0, stop = 0, step = 1; + int start = 0; + int stop = 0; + int step = 1; bool valid = true; try { std::size_t pos; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 51d8d43..d3a5535 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1033,8 +1033,8 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( // Support putting all the in-project include directories first if // it is requested by the project. if (this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")) { - std::string const &topSourceDir = this->GetState()->GetSourceDirectory(), - &topBinaryDir = this->GetState()->GetBinaryDirectory(); + std::string const& topSourceDir = this->GetState()->GetSourceDirectory(); + std::string const& topBinaryDir = this->GetState()->GetBinaryDirectory(); for (BT<std::string> const& udr : userDirs) { // Emit this directory only if it is a subdirectory of the // top-level source or binary tree. diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index ec35551..220553b 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -556,7 +556,8 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements() ++j; for (; j != i->second.end(); ++j) { - std::vector<std::string> jDeps, depsIntersection; + std::vector<std::string> jDeps; + std::vector<std::string> depsIntersection; this->GetGlobalNinjaGenerator()->AppendTargetDependsClosure(*j, jDeps); std::sort(jDeps.begin(), jDeps.end()); std::set_intersection(ccTargetDeps.begin(), ccTargetDeps.end(), diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 4ebeb60..15c6580 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -967,7 +967,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() >->GetPostBuildCommands() }; - std::vector<std::string> preLinkCmdLines, postBuildCmdLines; + std::vector<std::string> preLinkCmdLines; + std::vector<std::string> postBuildCmdLines; std::vector<std::string>* cmdLineLists[3] = { &preLinkCmdLines, &preLinkCmdLines, &postBuildCmdLines }; diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 8fca4c0..4f0f92b 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -43,7 +43,8 @@ void cmNinjaUtilityTargetGenerator::Generate() cmNinjaBuild phonyBuild("phony"); std::vector<std::string> commands; - cmNinjaDeps deps, util_outputs(1, utilCommandName); + cmNinjaDeps deps; + cmNinjaDeps util_outputs(1, utilCommandName); bool uses_terminal = false; { diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index 5e7e2f3..28d11cc 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -117,8 +117,8 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, return false; } - std::vector<std::string>::const_iterator argIter = args.begin(), - argEnd = args.end(); + std::vector<std::string>::const_iterator argIter = args.begin(); + std::vector<std::string>::const_iterator argEnd = args.end(); bool parseFromArgV = false; unsigned long argvStart = 0; if (*argIter == "PARSE_ARGV") { diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 2cbf113..7148fc1 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -1762,7 +1762,8 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile) // Headers { // Get file lists - const char *keyFiles = "AM_HEADERS", *keyFlags = "AM_HEADERS_FLAGS"; + const char* keyFiles = "AM_HEADERS"; + const char* keyFlags = "AM_HEADERS_FLAGS"; std::vector<std::string> files = InfoGetList(keyFiles); std::vector<std::string> flags = InfoGetList(keyFlags); std::vector<std::string> builds; @@ -1797,7 +1798,8 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile) // Sources { - const char *keyFiles = "AM_SOURCES", *keyFlags = "AM_SOURCES_FLAGS"; + const char* keyFiles = "AM_SOURCES"; + const char* keyFlags = "AM_SOURCES_FLAGS"; std::vector<std::string> files = InfoGetList(keyFiles); std::vector<std::string> flags = InfoGetList(keyFlags); if (!MatchSizes(keyFiles, keyFlags, files.size(), flags.size())) { diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 3461e67..caaa0a3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2375,7 +2375,8 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, { const char* endl = lhss; const char* endr = rhss; - unsigned long lhs, rhs; + unsigned long lhs; + unsigned long rhs; while (((*endl >= '0') && (*endl <= '9')) || ((*endr >= '0') && (*endr <= '9'))) { diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 4358194..2b553b0 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -51,7 +51,8 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args, void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader( const std::string& source, const std::string& outdir) { - std::string dir, file; + std::string dir; + std::string file; cmSystemTools::SplitProgramPath(source, dir, file); std::string outFile = outdir; outFile += "/"; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d036467..794119a 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -296,7 +296,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) return false; } } - std::string var, value; + std::string var; + std::string value; cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED; if (cmState::ParseCacheEntry(entry, var, value, type)) { // The value is transformed if it is a filepath for example, so @@ -2092,7 +2093,8 @@ void cmake::UpdateConversionPathTable() ". CMake can not open file."); cmSystemTools::ReportLastSystemError("CMake can not open file."); } else { - std::string a, b; + std::string a; + std::string b; while (!table.eof()) { // two entries per line table >> a; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index c35eff6..9f4bdda 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -763,8 +763,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) if (args[1] == "time" && args.size() > 2) { std::vector<std::string> command(args.begin() + 2, args.end()); - clock_t clock_start, clock_finish; - time_t time_start, time_finish; + clock_t clock_start; + clock_t clock_finish; + time_t time_start; + time_t time_finish; time(&time_start); clock_start = clock(); |