Commit cdfc4e31 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

clang-tidy: fix `readability-qualified-auto` warnings

parent 808b17b1
......@@ -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,\
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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();
}
......
......@@ -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);
}
}
......
......@@ -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);
......
......@@ -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 += "'";
......
......@@ -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)) {
......
......@@ -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();
......
......@@ -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;
......
......@@ -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();
......
......@@ -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();
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment