summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy1
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx12
-rw-r--r--Source/CTest/cmCTestResourceGroupsLexerHelper.cxx2
-rw-r--r--Source/CTest/cmProcess.cxx10
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx4
-rw-r--r--Source/cmAuxSourceDirectoryCommand.cxx2
-rw-r--r--Source/cmCMakePathCommand.cxx2
-rw-r--r--Source/cmCPluginAPI.cxx2
-rw-r--r--Source/cmCacheManager.cxx4
-rw-r--r--Source/cmCacheManager.h20
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx2
-rw-r--r--Source/cmExecuteProcessCommand.cxx2
-rw-r--r--Source/cmExportFileGenerator.cxx2
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx2
-rw-r--r--Source/cmFileAPICodemodel.cxx2
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx6
-rw-r--r--Source/cmGeneratorTarget.cxx4
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx12
-rw-r--r--Source/cmGlobalGenerator.cxx8
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx2
-rw-r--r--Source/cmGraphVizWriter.cxx4
-rw-r--r--Source/cmLinkItemGraphVisitor.cxx5
-rw-r--r--Source/cmLocalGenerator.cxx8
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx6
-rw-r--r--Source/cmMakefile.cxx4
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx2
-rw-r--r--Source/cmQtAutoMocUic.cxx2
-rw-r--r--Source/cmSetPropertyCommand.cxx4
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.cxx2
-rw-r--r--Source/cmSourceFile.cxx2
-rw-r--r--Source/cmSourceFileLocation.cxx4
-rw-r--r--Source/cmState.cxx2
-rw-r--r--Source/cmStringAlgorithms.cxx4
-rw-r--r--Source/cmTarget.cxx6
-rw-r--r--Source/cmUVHandlePtr.cxx5
-rw-r--r--Source/cmcmd.cxx4
36 files changed, 85 insertions, 80 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 098c71f05d..1ee68c2d9b 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -25,7 +25,6 @@ readability-*,\
-readability-inconsistent-declaration-parameter-name,\
-readability-magic-numbers,\
-readability-named-parameter,\
--readability-qualified-auto,\
-readability-redundant-access-specifiers,\
-readability-redundant-declaration,\
-readability-redundant-string-init,\
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 9793c5bb1e..852f9d91d8 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -621,7 +621,7 @@ void cmCTestMultiProcessHandler::StartNextTests()
void cmCTestMultiProcessHandler::OnTestLoadRetryCB(uv_timer_t* timer)
{
- auto self = static_cast<cmCTestMultiProcessHandler*>(timer->data);
+ auto* self = static_cast<cmCTestMultiProcessHandler*>(timer->data);
self->StartNextTests();
}
@@ -631,7 +631,7 @@ void cmCTestMultiProcessHandler::FinishTestProcess(
this->Completed++;
int test = runner->GetIndex();
- auto properties = runner->GetTestProperties();
+ auto* properties = runner->GetTestProperties();
bool testResult = runner->EndTest(this->Completed, this->Total, started);
if (runner->TimedOutForStopTime()) {
@@ -920,7 +920,7 @@ void cmCTestMultiProcessHandler::MarkFinished()
static Json::Value DumpToJsonArray(const std::set<std::string>& values)
{
Json::Value jsonArray = Json::arrayValue;
- for (auto& it : values) {
+ for (const auto& it : values) {
jsonArray.append(it);
}
return jsonArray;
@@ -929,7 +929,7 @@ static Json::Value DumpToJsonArray(const std::set<std::string>& values)
static Json::Value DumpToJsonArray(const std::vector<std::string>& values)
{
Json::Value jsonArray = Json::arrayValue;
- for (auto& it : values) {
+ for (const auto& it : values) {
jsonArray.append(it);
}
return jsonArray;
@@ -939,7 +939,7 @@ static Json::Value DumpRegExToJsonArray(
const std::vector<std::pair<cmsys::RegularExpression, std::string>>& values)
{
Json::Value jsonArray = Json::arrayValue;
- for (auto& it : values) {
+ for (const auto& it : values) {
jsonArray.append(it.second);
}
return jsonArray;
@@ -949,7 +949,7 @@ static Json::Value DumpMeasurementToJsonArray(
const std::map<std::string, std::string>& values)
{
Json::Value jsonArray = Json::arrayValue;
- for (auto& it : values) {
+ for (const auto& it : values) {
Json::Value measurement = Json::objectValue;
measurement["measurement"] = it.first;
measurement["value"] = it.second;
diff --git a/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx b/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx
index 072af42f03..4c26b3f094 100644
--- a/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx
+++ b/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx
@@ -17,7 +17,7 @@ bool cmCTestResourceGroupsLexerHelper::ParseString(const std::string& value)
yyscan_t lexer;
cmCTestResourceGroups_yylex_init_extra(this, &lexer);
- auto state = cmCTestResourceGroups_yy_scan_string(value.c_str(), lexer);
+ auto* state = cmCTestResourceGroups_yy_scan_string(value.c_str(), lexer);
int retval = cmCTestResourceGroups_yylex(lexer);
cmCTestResourceGroups_yy_delete_buffer(state, lexer);
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index 1f220af39c..16bca01b57 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -152,7 +152,7 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
void cmProcess::StartTimer()
{
- auto properties = this->Runner->GetTestProperties();
+ auto* properties = this->Runner->GetTestProperties();
auto msec =
std::chrono::duration_cast<std::chrono::milliseconds>(this->Timeout);
@@ -209,7 +209,7 @@ bool cmProcess::Buffer::GetLast(std::string& line)
void cmProcess::OnReadCB(uv_stream_t* stream, ssize_t nread,
const uv_buf_t* buf)
{
- auto self = static_cast<cmProcess*>(stream->data);
+ auto* self = static_cast<cmProcess*>(stream->data);
self->OnRead(nread, buf);
}
@@ -256,7 +256,7 @@ void cmProcess::OnRead(ssize_t nread, const uv_buf_t* buf)
void cmProcess::OnAllocateCB(uv_handle_t* handle, size_t suggested_size,
uv_buf_t* buf)
{
- auto self = static_cast<cmProcess*>(handle->data);
+ auto* self = static_cast<cmProcess*>(handle->data);
self->OnAllocate(suggested_size, buf);
}
@@ -272,7 +272,7 @@ void cmProcess::OnAllocate(size_t /*suggested_size*/, uv_buf_t* buf)
void cmProcess::OnTimeoutCB(uv_timer_t* timer)
{
- auto self = static_cast<cmProcess*>(timer->data);
+ auto* self = static_cast<cmProcess*>(timer->data);
self->OnTimeout();
}
@@ -298,7 +298,7 @@ void cmProcess::OnTimeout()
void cmProcess::OnExitCB(uv_process_t* process, int64_t exit_status,
int term_signal)
{
- auto self = static_cast<cmProcess*>(process->data);
+ auto* self = static_cast<cmProcess*>(process->data);
self->OnExit(exit_status, term_signal);
}
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 6fc556c08b..069c02ef83 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -405,7 +405,7 @@ void cmCursesMainForm::UpdateStatusBar(cm::optional<std::string> message)
// Get the help string of the current entry
// and add it to the help string
- auto cmakeState = this->CMakeInstance->GetState();
+ auto* cmakeState = this->CMakeInstance->GetState();
cmProp existingValue = cmakeState->GetCacheEntryValue(labelValue);
if (existingValue) {
cmProp help =
@@ -1000,7 +1000,7 @@ void cmCursesMainForm::DisplayOutputs(std::string const& newOutput)
getmaxyx(stdscr, yi, xi);
if (CurrentForm != this->LogForm.get()) {
- auto newLogForm = new cmCursesLongMessageForm(
+ auto* newLogForm = new cmCursesLongMessageForm(
this->Outputs, this->LastProgress.c_str(),
cmCursesLongMessageForm::ScrollBehavior::ScrollDown);
CurrentForm = newLogForm;
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 15edcc5664..35f4c8881c 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -51,7 +51,7 @@ bool cmAuxSourceDirectoryCommand(std::vector<std::string> const& args,
if (dotpos != std::string::npos) {
auto ext = cm::string_view(file).substr(dotpos + 1);
// Process only source files
- auto cm = mf.GetCMakeInstance();
+ auto* cm = mf.GetCMakeInstance();
if (dotpos > 0 && cm->IsACLikeSourceExtension(ext)) {
std::string fullname = cmStrCat(templateDirectory, '/', file);
// add the file as a class file so
diff --git a/Source/cmCMakePathCommand.cxx b/Source/cmCMakePathCommand.cxx
index 5662a2f5a2..e14dce0625 100644
--- a/Source/cmCMakePathCommand.cxx
+++ b/Source/cmCMakePathCommand.cxx
@@ -149,7 +149,7 @@ public:
bool getInputPath(const std::string& arg, cmExecutionStatus& status,
std::string& path)
{
- auto def = status.GetMakefile().GetDefinition(arg);
+ const auto* def = status.GetMakefile().GetDefinition(arg);
if (def == nullptr) {
status.SetError("undefined variable for input path.");
return false;
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 9e3582c5a1..987b0eb35b 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -567,7 +567,7 @@ void* CCONV cmAddSource(void* arg, void* arg2)
sf->SourceExtension = osf->SourceExtension;
// Store the proxy in the map so it can be re-used and deleted later.
- auto value = sf.get();
+ auto* value = sf.get();
cmCPluginAPISourceFiles[rsf] = std::move(sf);
return value;
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 8d1a5fd3fc..1a950dfb0f 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -183,7 +183,7 @@ bool cmCacheManager::ReadPropertyEntry(const std::string& entryKey,
if (entryKey.size() > plen && *(end - plen) == '-' &&
strcmp(end - plen + 1, p) == 0) {
std::string key = entryKey.substr(0, entryKey.size() - plen);
- if (auto entry = this->GetCacheEntry(key)) {
+ if (auto* entry = this->GetCacheEntry(key)) {
// Store this property on its entry.
entry->SetProperty(p, e.Value.c_str());
} else {
@@ -498,7 +498,7 @@ const cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
cmProp cmCacheManager::GetInitializedCacheValue(const std::string& key) const
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (const auto* entry = this->GetCacheEntry(key)) {
if (entry->Initialized) {
return &entry->GetValue();
}
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 9aebffc0d7..7a9a7dc415 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -74,7 +74,7 @@ public:
cmProp GetCacheEntryValue(const std::string& key) const
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (const auto* entry = this->GetCacheEntry(key)) {
return &entry->GetValue();
}
return nullptr;
@@ -82,14 +82,14 @@ public:
void SetCacheEntryValue(std::string const& key, std::string const& value)
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (auto* entry = this->GetCacheEntry(key)) {
entry->SetValue(value.c_str());
}
}
cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (const auto* entry = this->GetCacheEntry(key)) {
return entry->GetType();
}
return cmStateEnums::UNINITIALIZED;
@@ -98,7 +98,7 @@ public:
std::vector<std::string> GetCacheEntryPropertyList(
std::string const& key) const
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (const auto* entry = this->GetCacheEntry(key)) {
return entry->GetPropertyList();
}
return {};
@@ -107,7 +107,7 @@ public:
cmProp GetCacheEntryProperty(std::string const& key,
std::string const& propName) const
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (const auto* entry = this->GetCacheEntry(key)) {
return entry->GetProperty(propName);
}
return nullptr;
@@ -116,7 +116,7 @@ public:
bool GetCacheEntryPropertyAsBool(std::string const& key,
std::string const& propName) const
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (const auto* entry = this->GetCacheEntry(key)) {
return entry->GetPropertyAsBool(propName);
}
return false;
@@ -126,7 +126,7 @@ public:
std::string const& propName,
std::string const& value)
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (auto* entry = this->GetCacheEntry(key)) {
entry->SetProperty(propName, value.c_str());
}
}
@@ -134,7 +134,7 @@ public:
void SetCacheEntryBoolProperty(std::string const& key,
std::string const& propName, bool value)
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (auto* entry = this->GetCacheEntry(key)) {
entry->SetProperty(propName, value);
}
}
@@ -142,7 +142,7 @@ public:
void RemoveCacheEntryProperty(std::string const& key,
std::string const& propName)
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (auto* entry = this->GetCacheEntry(key)) {
entry->SetProperty(propName, nullptr);
}
}
@@ -152,7 +152,7 @@ public:
std::string const& value,
bool asString = false)
{
- if (auto entry = this->GetCacheEntry(key)) {
+ if (auto* entry = this->GetCacheEntry(key)) {
entry->AppendProperty(propName, value, asString);
}
}
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 6d5e064f5d..deddba8ef0 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -228,7 +228,7 @@ int cmCommandArgumentParserHelper::ParseString(std::string const& str,
yyscan_t yyscanner;
cmCommandArgument_yylex_init(&yyscanner);
- auto scanBuf = cmCommandArgument_yy_scan_string(str.c_str(), yyscanner);
+ auto* scanBuf = cmCommandArgument_yy_scan_string(str.c_str(), yyscanner);
cmCommandArgument_yyset_extra(this, yyscanner);
cmCommandArgument_SetupEscapes(yyscanner, this->NoEscapeMode);
int res = cmCommandArgument_yyparse(yyscanner);
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index 5a85b7de4d..ffcc415a1b 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -231,7 +231,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
}
if (echo_stdout || echo_stderr) {
std::string command;
- for (auto& cmd : arguments.Commands) {
+ for (const auto& cmd : arguments.Commands) {
command += "'";
command += cmJoin(cmd, "' '");
command += "'";
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 113751a9e9..7015a01298 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -1214,7 +1214,7 @@ bool cmExportFileGenerator::PopulateExportProperties(
cmGeneratorTarget* gte, ImportPropertyMap& properties,
std::string& errorMessage)
{
- auto& targetProperties = gte->Target->GetProperties();
+ const auto& targetProperties = gte->Target->GetProperties();
if (cmProp exportProperties =
targetProperties.GetPropertyValue("EXPORT_PROPERTIES")) {
for (auto& prop : cmExpandedList(*exportProperties)) {
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 800db8a96e..f217201749 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -341,7 +341,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
all_files_map_t allFiles;
std::vector<std::string> cFiles;
- auto cm = this->GlobalGenerator->GetCMakeInstance();
+ auto* cm = this->GlobalGenerator->GetCMakeInstance();
for (cmLocalGenerator* lg : lgs) {
cmMakefile* makefile = lg->GetMakefile();
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 7fcc3dc73f..90611092ba 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -1324,7 +1324,7 @@ Json::Value Target::DumpInstallDestinations()
{
Json::Value destinations = Json::arrayValue;
auto installGens = this->GT->Target->GetInstallGenerators();
- for (auto itGen : installGens) {
+ for (auto* itGen : installGens) {
destinations.append(this->DumpInstallDestination(itGen));
}
return destinations;
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 4129a0c4fd..fec309cb91 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -31,7 +31,7 @@ std::string GeneratorExpressionContent::ProcessArbitraryContent(
const auto pend = this->ParamChildren.end();
for (; pit != pend; ++pit) {
- for (auto& pExprEval : *pit) {
+ for (const auto& pExprEval : *pit) {
if (node->RequiresLiteralInput()) {
if (pExprEval->GetType() != cmGeneratorExpressionEvaluator::Text) {
reportError(context, this->GetOriginalExpression(),
@@ -63,7 +63,7 @@ std::string GeneratorExpressionContent::Evaluate(
{
std::string identifier;
{
- for (auto& pExprEval : this->IdentifierChildren) {
+ for (const auto& pExprEval : this->IdentifierChildren) {
identifier += pExprEval->Evaluate(context, dagChecker);
if (context->HadError) {
return std::string();
@@ -124,7 +124,7 @@ std::string GeneratorExpressionContent::EvaluateParameters(
return std::string();
}
std::string parameter;
- for (auto& pExprEval : *pit) {
+ for (const auto& pExprEval : *pit) {
parameter += pExprEval->Evaluate(context, dagChecker);
if (context->HadError) {
return std::string();
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 17d211e627..092fd5a6cc 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -4051,7 +4051,7 @@ std::string cmGeneratorTarget::GetPchFileObject(const std::string& config,
}
std::string& filename = inserted.first->second;
- auto pchSf = this->Makefile->GetOrCreateSource(
+ auto* pchSf = this->Makefile->GetOrCreateSource(
pchSource, false, cmSourceFileLocationKind::Known);
filename = cmStrCat(this->ObjectDirectory, this->GetObjectName(pchSf));
@@ -7360,7 +7360,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
std::string name = this->CheckCMP0004(lib);
if (this->GetPolicyStatusCMP0108() == cmPolicies::NEW) {
// resolve alias name
- auto target = this->Makefile->FindTargetToUse(name);
+ auto* target = this->Makefile->FindTargetToUse(name);
if (target) {
name = target->GetName();
}
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index a7658f2b4e..3c44a885fc 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -356,7 +356,7 @@ void cmGhsMultiTargetGenerator::WriteBuildEventsHelper(
} else {
fout << fname << "\n :outputName=\"" << fname << ".rule\"\n";
}
- for (auto& byp : ccg.GetByproducts()) {
+ for (const auto& byp : ccg.GetByproducts()) {
fout << " :extraOutputFile=\"" << byp << "\"\n";
}
}
@@ -528,7 +528,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
}
}
- for (auto& n : groupNames) {
+ for (const auto& n : groupNames) {
groupFilesList[i] = n;
i += 1;
}
@@ -691,14 +691,14 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandLine(
* the outputs is manually deleted.
*/
bool specifyExtra = true;
- for (auto& out : ccg.GetOutputs()) {
+ for (const auto& out : ccg.GetOutputs()) {
fout << fname << '\n';
fout << " :outputName=\"" << out << "\"\n";
if (specifyExtra) {
- for (auto& byp : ccg.GetByproducts()) {
+ for (const auto& byp : ccg.GetByproducts()) {
fout << " :extraOutputFile=\"" << byp << "\"\n";
}
- for (auto& dep : ccg.GetDepends()) {
+ for (const auto& dep : ccg.GetDepends()) {
fout << " :depends=\"" << dep << "\"\n";
}
specifyExtra = false;
@@ -761,7 +761,7 @@ bool cmGhsMultiTargetGenerator::VisitCustomCommand(
if (perm.find(si) == perm.end()) {
/* set temporary mark; check if revisit*/
if (temp.insert(si).second) {
- for (auto& di : si->GetCustomCommand()->GetDepends()) {
+ for (const auto& di : si->GetCustomCommand()->GetDepends()) {
cmSourceFile const* sf =
this->GeneratorTarget->GetLocalGenerator()->GetSourceFileWithOutput(
di);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 63aaf27a0f..9230091ebf 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1229,7 +1229,7 @@ void cmGlobalGenerator::Configure()
this->CMakeInstance->GetHomeOutputDirectory());
auto dirMfu = cm::make_unique<cmMakefile>(this, snapshot);
- auto dirMf = dirMfu.get();
+ auto* dirMf = dirMfu.get();
this->Makefiles.push_back(std::move(dirMfu));
dirMf->SetRecursionDepth(this->RecursionDepth);
this->IndexMakefile(dirMf);
@@ -1627,8 +1627,8 @@ void cmGlobalGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt,
}
auto entry = insertion.first;
- auto& deps = this->GetTargetDirectDepends(gt);
- for (auto& d : deps) {
+ const auto& deps = this->GetTargetDirectDepends(gt);
+ for (const auto& d : deps) {
this->ComputeTargetOrder(d, index);
}
@@ -2928,7 +2928,7 @@ void cmGlobalGenerator::GetTargetSets(
cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators)
{
// loop over all local generators
- for (auto generator : generators) {
+ for (auto* generator : generators) {
// check to make sure generator is not excluded
if (this->IsExcluded(root, generator)) {
continue;
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 0ddfe77593..172cf3fc0c 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -704,7 +704,7 @@ bool cmGlobalGhsMultiGenerator::ComputeTargetBuildOrder(
std::set<cmGeneratorTarget const*> temp;
std::set<cmGeneratorTarget const*> perm;
- for (auto const ti : tgt) {
+ for (const auto* const ti : tgt) {
bool r = this->VisitTarget(temp, perm, build, ti);
if (r) {
return r;
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 95cac20d51..122bda52dc 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -282,7 +282,7 @@ void cmGraphVizWriter::ReadSettings(
void cmGraphVizWriter::Write()
{
- auto gg = this->GlobalGenerator;
+ const auto* gg = this->GlobalGenerator;
this->VisitGraph(gg->GetName());
@@ -303,7 +303,7 @@ void cmGraphVizWriter::Write()
}
// write global data and collect all connection data for per target graphs
- for (auto const gt : sortedGeneratorTargets) {
+ for (const auto* const gt : sortedGeneratorTargets) {
auto item = cmLinkItem(gt, false, gt->GetBacktrace());
this->VisitItem(item);
}
diff --git a/Source/cmLinkItemGraphVisitor.cxx b/Source/cmLinkItemGraphVisitor.cxx
index dfdd3ff65c..7ad8690fd7 100644
--- a/Source/cmLinkItemGraphVisitor.cxx
+++ b/Source/cmLinkItemGraphVisitor.cxx
@@ -98,7 +98,8 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target,
std::string const& config,
DependencyMap& dependencies)
{
- auto implementationLibraries = target.GetLinkImplementationLibraries(config);
+ const auto* implementationLibraries =
+ target.GetLinkImplementationLibraries(config);
if (implementationLibraries != nullptr) {
for (auto const& lib : implementationLibraries->Libraries) {
auto const& name = lib.AsStr();
@@ -106,7 +107,7 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target,
}
}
- auto interfaceLibraries =
+ const auto* interfaceLibraries =
target.GetLinkInterfaceLibraries(config, &target, true);
if (interfaceLibraries != nullptr) {
for (auto const& lib : interfaceLibraries->Libraries) {
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 9248cbbd16..bd384465f2 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2553,7 +2553,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
cmProp ReuseFrom =
target->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
- auto pch_sf = this->Makefile->GetOrCreateSource(
+ auto* pch_sf = this->Makefile->GetOrCreateSource(
pchSource, false, cmSourceFileLocationKind::Known);
if (!this->GetGlobalGenerator()->IsXcode()) {
@@ -2570,7 +2570,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
"OBJECT_OUTPUTS",
cmStrCat("$<$<CONFIG:", config, ">:", pchFile, ">"));
} else {
- auto reuseTarget =
+ auto* reuseTarget =
this->GlobalGenerator->FindGeneratorTarget(*ReuseFrom);
if (this->Makefile->IsOn("CMAKE_PCH_COPY_COMPILE_PDB")) {
@@ -2633,7 +2633,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
// Add pchHeader to source files, which will
// be grouped as "Precompile Header File"
- auto pchHeader_sf = this->Makefile->GetOrCreateSource(
+ auto* pchHeader_sf = this->Makefile->GetOrCreateSource(
pchHeader, false, cmSourceFileLocationKind::Known);
std::string err;
pchHeader_sf->ResolveFullPath(&err);
@@ -2961,7 +2961,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
}
for (auto const& file : unity_files) {
- auto unity = this->GetMakefile()->GetOrCreateSource(file);
+ auto* unity = this->GetMakefile()->GetOrCreateSource(file);
target->AddSource(file, true);
unity->SetProperty("SKIP_UNITY_BUILD_INCLUSION", "ON");
unity->SetProperty("UNITY_SOURCE_FILE", file.c_str());
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index df7952cf14..464df68542 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -151,8 +151,8 @@ void cmLocalUnixMakefileGenerator3::Generate()
}
auto& gtVisited = this->GetCommandsVisited(gt);
- auto& deps = this->GlobalGenerator->GetTargetDirectDepends(gt);
- for (auto& d : deps) {
+ const auto& deps = this->GlobalGenerator->GetTargetDirectDepends(gt);
+ for (const auto& d : deps) {
// Take the union of visited source files of custom commands
auto depVisited = this->GetCommandsVisited(d);
gtVisited.insert(depVisited.begin(), depVisited.end());
@@ -718,7 +718,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop(
constexpr const char* vcs_rules[] = {
"%,v", "RCS/%", "RCS/%,v", "SCCS/s.%", "s.%",
};
- for (auto vcs_rule : vcs_rules) {
+ for (const auto* vcs_rule : vcs_rules) {
std::vector<std::string> vcs_depend;
vcs_depend.emplace_back(vcs_rule);
this->WriteMakeRule(makefileStream, "Disable VCS-based implicit rules.",
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cea20ad675..0fc8fa3081 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1824,7 +1824,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
auto subMfu =
cm::make_unique<cmMakefile>(this->GlobalGenerator, newSnapshot);
- auto subMf = subMfu.get();
+ auto* subMf = subMfu.get();
this->GetGlobalGenerator()->AddMakefile(std::move(subMfu));
if (excludeFromAll) {
@@ -3370,7 +3370,7 @@ cmSourceFile* cmMakefile::GetSource(const std::string& sourceName,
#endif
auto sfsi = this->SourceFileSearchIndex.find(name);
if (sfsi != this->SourceFileSearchIndex.end()) {
- for (auto sf : sfsi->second) {
+ for (auto* sf : sfsi->second) {
if (sf->Matches(sfl)) {
return sf;
}
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index aa5abcb7a0..d589614d7e 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -376,7 +376,7 @@ protected:
}
// Didn't find an instance. Create a new one and save it.
auto info = cm::make_unique<cmDependInformation>();
- auto ptr = info.get();
+ auto* ptr = info.get();
info->FullPath = fullPath;
info->PathOnly = cmSystemTools::GetFilenamePath(fullPath);
info->IncludeName = file;
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index 35560510f7..a9cc1c6e62 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -2708,7 +2708,7 @@ void cmQtAutoMocUicT::CreateParseJobs(SourceFileMapT const& sourceMap)
{
cmFileTime const parseCacheTime = this->BaseEval().ParseCacheTime;
ParseCacheT& parseCache = this->BaseEval().ParseCache;
- for (auto& src : sourceMap) {
+ for (const auto& src : sourceMap) {
// Get or create the file parse data reference
ParseCacheT::GetOrInsertT cacheEntry = parseCache.GetOrInsert(src.first);
src.second->ParseData = std::move(cacheEntry.first);
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 1a3aab8f83..c8990537ba 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -223,7 +223,7 @@ void MakeSourceFilePathsAbsoluteIfNeeded(
bool HandleAndValidateSourceFilePropertyGENERATED(
cmSourceFile* sf, std::string const& propertyValue, PropertyOp op)
{
- auto& mf = *sf->GetLocation().GetMakefile();
+ const auto& mf = *sf->GetLocation().GetMakefile();
auto policyStatus = mf.GetPolicyStatus(cmPolicies::CMP0118);
const bool policyWARN = policyStatus == cmPolicies::WARN;
@@ -589,7 +589,7 @@ bool HandleSourceMode(cmExecutionStatus& status,
status, files_absolute, unique_files.begin(), unique_files.end(),
source_file_paths_should_be_absolute);
- for (const auto mf : directory_makefiles) {
+ for (auto* const mf : directory_makefiles) {
for (std::string const& name : files_absolute) {
// Get the source file.
if (cmSourceFile* sf = mf->GetOrCreateSource(name)) {
diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx
index 742aa96b6f..237b67fedb 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.cxx
+++ b/Source/cmSetSourceFilesPropertiesCommand.cxx
@@ -101,7 +101,7 @@ bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args,
// Now call the worker function for each directory scope represented by a
// cmMakefile instance.
std::string errors;
- for (const auto mf : source_file_directory_makefiles) {
+ for (auto* const mf : source_file_directory_makefiles) {
bool ret = RunCommandForScope(mf, files.begin(), files.end(), props_begin,
args.end(), errors);
if (!ret) {
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 9d9a7c3159..72bc9729f3 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -427,7 +427,7 @@ bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const
void cmSourceFile::MarkAsGenerated()
{
this->IsGenerated = true;
- auto& mf = *this->Location.GetMakefile();
+ const auto& mf = *this->Location.GetMakefile();
mf.GetGlobalGenerator()->MarkAsGeneratedFile(this->ResolveFullPath());
}
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 921eb0ebc6..8c7154d7ff 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -98,7 +98,7 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name)
// The global generator checks extensions of enabled languages.
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
cmMakefile const* mf = this->Makefile;
- auto cm = mf->GetCMakeInstance();
+ auto* cm = mf->GetCMakeInstance();
if (!gg->GetLanguageFromExtension(ext.c_str()).empty() ||
cm->IsAKnownExtension(ext)) {
// This is a known extension. Use the given filename with extension.
@@ -155,7 +155,7 @@ bool cmSourceFileLocation::MatchesAmbiguousExtension(
// disk. One of these must match if loc refers to this source file.
auto ext = cm::string_view(this->Name).substr(loc.Name.size() + 1);
cmMakefile const* mf = this->Makefile;
- auto cm = mf->GetCMakeInstance();
+ auto* cm = mf->GetCMakeInstance();
return cm->IsAKnownExtension(ext);
}
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 0fd79012c2..4252022a68 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -347,7 +347,7 @@ cmPropertyDefinition const* cmState::GetPropertyDefinition(
bool cmState::IsPropertyChained(const std::string& name,
cmProperty::ScopeType scope) const
{
- if (auto def = this->GetPropertyDefinition(name, scope)) {
+ if (const auto* def = this->GetPropertyDefinition(name, scope)) {
return def->IsChained();
}
return false;
diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx
index fb0b705c4c..5bb6e7bc57 100644
--- a/Source/cmStringAlgorithms.cxx
+++ b/Source/cmStringAlgorithms.cxx
@@ -11,6 +11,9 @@
std::string cmTrimWhitespace(cm::string_view str)
{
+ // XXX(clang-tidy): This declaration and the next cannot be `const auto*`
+ // because the qualification of `auto` is platform-dependent.
+ // NOLINTNEXTLINE(readability-qualified-auto)
auto start = str.begin();
while (start != str.end() && cmIsSpace(*start)) {
++start;
@@ -18,6 +21,7 @@ std::string cmTrimWhitespace(cm::string_view str)
if (start == str.end()) {
return std::string();
}
+ // NOLINTNEXTLINE(readability-qualified-auto)
auto stop = str.end() - 1;
while (cmIsSpace(*stop)) {
--stop;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1fd235528e..c12d5dd68d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1328,9 +1328,9 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
return;
}
- auto reusedTarget = this->impl->Makefile->GetCMakeInstance()
- ->GetGlobalGenerator()
- ->FindTarget(value);
+ auto* reusedTarget = this->impl->Makefile->GetCMakeInstance()
+ ->GetGlobalGenerator()
+ ->FindTarget(value);
if (!reusedTarget) {
const std::string e(
"PRECOMPILE_HEADERS_REUSE_FROM set with non existing target");
diff --git a/Source/cmUVHandlePtr.cxx b/Source/cmUVHandlePtr.cxx
index e556a11b19..8ea19423da 100644
--- a/Source/cmUVHandlePtr.cxx
+++ b/Source/cmUVHandlePtr.cxx
@@ -59,7 +59,7 @@ uv_loop_t* uv_loop_ptr::get() const
template <typename T>
static void handle_default_delete(T* type_handle)
{
- auto handle = reinterpret_cast<uv_handle_t*>(type_handle);
+ auto* handle = reinterpret_cast<uv_handle_t*>(type_handle);
if (handle) {
assert(!uv_is_closing(handle));
if (!uv_is_closing(handle)) {
@@ -154,7 +154,8 @@ struct uv_handle_deleter<uv_async_t>
void uv_async_ptr::send()
{
- auto deleter = std::get_deleter<uv_handle_deleter<uv_async_t>>(this->handle);
+ auto* deleter =
+ std::get_deleter<uv_handle_deleter<uv_async_t>>(this->handle);
assert(deleter);
std::lock_guard<std::mutex> lock(*deleter->handleMutex);
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index f6d8901918..5791c0509e 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1885,7 +1885,7 @@ int cmcmd::RunPreprocessor(const std::vector<std::string>& command,
}
auto status = process.GetStatus();
if (!status[0] || status[0]->ExitStatus != 0) {
- auto errorStream = process.ErrorStream();
+ auto* errorStream = process.ErrorStream();
if (errorStream) {
std::cerr << errorStream->rdbuf();
}
@@ -2013,7 +2013,7 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args)
}
auto status = process.GetStatus();
if (!status[0] || status[0]->ExitStatus != 0) {
- auto errorStream = process.ErrorStream();
+ auto* errorStream = process.ErrorStream();
if (errorStream) {
std::cerr << errorStream->rdbuf();
}