mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-13 01:29:02 -05:00
Merge topic 'clang-tidy-fixes'
ef935b17abclang-tidy: fix `readability-use-anyofallof` warnings9ac8dbbb94clang-tidy: fix `readability-simplify-boolean-expr` warningsca505718f4clang-tidy: fix `readability-redundant-string-init` warningsb3b6ede6a1clang-tidy: fix `readability-redundant-access-specifiers` warningscdfc4e3195clang-tidy: fix `readability-qualified-auto` warnings808b17b120clang-tidy: fix `readability-make-member-function-const` warnings4470eb5179clang-tidy: fix `performance-trivially-destructible` warnings4f396e6528clang-tidy: fix `performance-no-automatic-move` warnings ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5731
This commit is contained in:
-11
@@ -4,9 +4,6 @@ bugprone-*,\
|
||||
-bugprone-macro-parentheses,\
|
||||
-bugprone-misplaced-widening-cast,\
|
||||
-bugprone-narrowing-conversions,\
|
||||
-bugprone-reserved-identifier,\
|
||||
-bugprone-signed-char-misuse,\
|
||||
-bugprone-suspicious-include,\
|
||||
-bugprone-too-small-loop-variable,\
|
||||
google-readability-casting,\
|
||||
misc-*,\
|
||||
@@ -20,8 +17,6 @@ modernize-*,\
|
||||
-modernize-use-trailing-return-type,\
|
||||
-modernize-use-transparent-functors,\
|
||||
performance-*,\
|
||||
-performance-no-automatic-move,\
|
||||
-performance-trivially-destructible,\
|
||||
readability-*,\
|
||||
-readability-convert-member-functions-to-static,\
|
||||
-readability-function-size,\
|
||||
@@ -29,15 +24,9 @@ readability-*,\
|
||||
-readability-implicit-bool-conversion,\
|
||||
-readability-inconsistent-declaration-parameter-name,\
|
||||
-readability-magic-numbers,\
|
||||
-readability-make-member-function-const,\
|
||||
-readability-named-parameter,\
|
||||
-readability-qualified-auto,\
|
||||
-readability-redundant-access-specifiers,\
|
||||
-readability-redundant-declaration,\
|
||||
-readability-redundant-string-init,\
|
||||
-readability-simplify-boolean-expr,\
|
||||
-readability-uppercase-literal-suffix,\
|
||||
-readability-use-anyofallof,\
|
||||
"
|
||||
HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$'
|
||||
CheckOptions:
|
||||
|
||||
@@ -44,7 +44,7 @@ bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const
|
||||
: false;
|
||||
}
|
||||
|
||||
bool cmCPackIFWCommon::IsVersionLess(const char* version)
|
||||
bool cmCPackIFWCommon::IsVersionLess(const char* version) const
|
||||
{
|
||||
if (!this->Generator) {
|
||||
return false;
|
||||
@@ -54,7 +54,7 @@ bool cmCPackIFWCommon::IsVersionLess(const char* version)
|
||||
cmSystemTools::OP_LESS, this->Generator->FrameworkVersion.data(), version);
|
||||
}
|
||||
|
||||
bool cmCPackIFWCommon::IsVersionGreater(const char* version)
|
||||
bool cmCPackIFWCommon::IsVersionGreater(const char* version) const
|
||||
{
|
||||
if (!this->Generator) {
|
||||
return false;
|
||||
@@ -65,7 +65,7 @@ bool cmCPackIFWCommon::IsVersionGreater(const char* version)
|
||||
version);
|
||||
}
|
||||
|
||||
bool cmCPackIFWCommon::IsVersionEqual(const char* version)
|
||||
bool cmCPackIFWCommon::IsVersionEqual(const char* version) const
|
||||
{
|
||||
if (!this->Generator) {
|
||||
return false;
|
||||
@@ -118,7 +118,7 @@ void cmCPackIFWCommon::ExpandListArgument(
|
||||
}
|
||||
}
|
||||
|
||||
void cmCPackIFWCommon::WriteGeneratedByToStrim(cmXMLWriter& xout)
|
||||
void cmCPackIFWCommon::WriteGeneratedByToStrim(cmXMLWriter& xout) const
|
||||
{
|
||||
if (!this->Generator) {
|
||||
return;
|
||||
|
||||
@@ -34,17 +34,17 @@ public:
|
||||
/**
|
||||
* Compare \a version with QtIFW framework version
|
||||
*/
|
||||
bool IsVersionLess(const char* version);
|
||||
bool IsVersionLess(const char* version) const;
|
||||
|
||||
/**
|
||||
* Compare \a version with QtIFW framework version
|
||||
*/
|
||||
bool IsVersionGreater(const char* version);
|
||||
bool IsVersionGreater(const char* version) const;
|
||||
|
||||
/**
|
||||
* Compare \a version with QtIFW framework version
|
||||
*/
|
||||
bool IsVersionEqual(const char* version);
|
||||
bool IsVersionEqual(const char* version) const;
|
||||
|
||||
/** Expand the list argument containing the map of the key-value pairs.
|
||||
* If the number of elements is odd, then the first value is used as the
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
cmCPackIFWGenerator* Generator;
|
||||
|
||||
protected:
|
||||
void WriteGeneratedByToStrim(cmXMLWriter& xout);
|
||||
void WriteGeneratedByToStrim(cmXMLWriter& xout) const;
|
||||
};
|
||||
|
||||
#define cmCPackIFWLogger(logType, msg) \
|
||||
|
||||
@@ -199,7 +199,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml()
|
||||
return cmSystemTools::RenameFile(updatesPatchXml, updatesXml);
|
||||
}
|
||||
|
||||
void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout)
|
||||
void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) const
|
||||
{
|
||||
xout.StartElement("Repository");
|
||||
|
||||
@@ -225,7 +225,7 @@ void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout)
|
||||
xout.EndElement();
|
||||
}
|
||||
|
||||
void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout)
|
||||
void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) const
|
||||
{
|
||||
xout.StartElement("Repository");
|
||||
|
||||
|
||||
@@ -76,8 +76,8 @@ public:
|
||||
|
||||
bool PatchUpdatesXml();
|
||||
|
||||
void WriteRepositoryConfig(cmXMLWriter& xout);
|
||||
void WriteRepositoryUpdate(cmXMLWriter& xout);
|
||||
void WriteRepositoryConfig(cmXMLWriter& xout) const;
|
||||
void WriteRepositoryUpdate(cmXMLWriter& xout) const;
|
||||
void WriteRepositoryUpdates(cmXMLWriter& xout);
|
||||
|
||||
RepositoriesVector RepositoryUpdate;
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
this->PipeState = cmsysProcess_WaitForExit(this->Process, timeout);
|
||||
return this->PipeState;
|
||||
}
|
||||
int GetProcessState() { return this->PipeState; }
|
||||
int GetProcessState() const { return this->PipeState; }
|
||||
|
||||
private:
|
||||
int PipeState;
|
||||
|
||||
@@ -265,7 +265,7 @@ void cmCTestLaunch::LoadScrapeRules()
|
||||
}
|
||||
|
||||
void cmCTestLaunch::LoadScrapeRules(
|
||||
const char* purpose, std::vector<cmsys::RegularExpression>& regexps)
|
||||
const char* purpose, std::vector<cmsys::RegularExpression>& regexps) const
|
||||
{
|
||||
std::string fname =
|
||||
cmStrCat(this->Reporter.LogDir, "Custom", purpose, ".txt");
|
||||
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
bool ScrapeRulesLoaded;
|
||||
void LoadScrapeRules();
|
||||
void LoadScrapeRules(const char* purpose,
|
||||
std::vector<cmsys::RegularExpression>& regexps);
|
||||
std::vector<cmsys::RegularExpression>& regexps) const;
|
||||
bool ScrapeLog(std::string const& fname);
|
||||
|
||||
// Helper class to generate the xml fragment.
|
||||
|
||||
@@ -150,7 +150,7 @@ void cmCTestLaunchReporter::WriteXML()
|
||||
this->WriteXMLLabels(e2);
|
||||
}
|
||||
|
||||
void cmCTestLaunchReporter::WriteXMLAction(cmXMLElement& e2)
|
||||
void cmCTestLaunchReporter::WriteXMLAction(cmXMLElement& e2) const
|
||||
{
|
||||
e2.Comment("Meta-information about the build action");
|
||||
cmXMLElement e3(e2, "Action");
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
|
||||
// Methods to generate the xml fragment.
|
||||
void WriteXML();
|
||||
void WriteXMLAction(cmXMLElement&);
|
||||
void WriteXMLAction(cmXMLElement&) const;
|
||||
void WriteXMLCommand(cmXMLElement&);
|
||||
void WriteXMLResult(cmXMLElement&);
|
||||
void WriteXMLLabels(cmXMLElement&);
|
||||
|
||||
@@ -300,7 +300,7 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile* mf)
|
||||
this->CustomTestsIgnore);
|
||||
}
|
||||
|
||||
int cmCTestMemCheckHandler::GetDefectCount()
|
||||
int cmCTestMemCheckHandler::GetDefectCount() const
|
||||
{
|
||||
return this->DefectCount;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
void Initialize() override;
|
||||
|
||||
int GetDefectCount();
|
||||
int GetDefectCount() const;
|
||||
|
||||
protected:
|
||||
int PreProcessHandler() override;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -1675,7 +1675,7 @@ std::string cmCTestTestHandler::FindExecutable(
|
||||
// if everything else failed, check the users path, but only if a full path
|
||||
// wasn't specified
|
||||
if (fullPath.empty() && filepath.empty()) {
|
||||
std::string const path = cmSystemTools::FindProgram(filename.c_str());
|
||||
std::string path = cmSystemTools::FindProgram(filename.c_str());
|
||||
if (!path.empty()) {
|
||||
resultingConfig.clear();
|
||||
return path;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ void cmProcess::ResetStartTime()
|
||||
this->StartTime = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
||||
cmProcess::Exception cmProcess::GetExitException()
|
||||
cmProcess::Exception cmProcess::GetExitException() const
|
||||
{
|
||||
auto exception = Exception::None;
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
@@ -430,7 +430,7 @@ cmProcess::Exception cmProcess::GetExitException()
|
||||
return exception;
|
||||
}
|
||||
|
||||
std::string cmProcess::GetExitExceptionString()
|
||||
std::string cmProcess::GetExitExceptionString() const
|
||||
{
|
||||
std::string exception_str;
|
||||
#if defined(_WIN32)
|
||||
|
||||
@@ -67,8 +67,8 @@ public:
|
||||
Other
|
||||
};
|
||||
|
||||
Exception GetExitException();
|
||||
std::string GetExitExceptionString();
|
||||
Exception GetExitException() const;
|
||||
std::string GetExitExceptionString() const;
|
||||
|
||||
std::unique_ptr<cmCTestRunTest> GetRunner()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -36,8 +36,6 @@ void Base32Encode5(const unsigned char src[5], char dst[8])
|
||||
|
||||
cmBase32Encoder::cmBase32Encoder() = default;
|
||||
|
||||
cmBase32Encoder::~cmBase32Encoder() = default;
|
||||
|
||||
std::string cmBase32Encoder::encodeString(const unsigned char* input,
|
||||
size_t len, bool padding)
|
||||
{
|
||||
|
||||
+1
-2
@@ -17,9 +17,8 @@ class cmBase32Encoder
|
||||
public:
|
||||
static const char paddingChar = '=';
|
||||
|
||||
public:
|
||||
cmBase32Encoder();
|
||||
~cmBase32Encoder();
|
||||
~cmBase32Encoder() = default;
|
||||
|
||||
// Encodes the given input byte sequence into a string
|
||||
// @arg input Input data pointer
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmCMakePresetsFile.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
#include <cmext/string_view>
|
||||
@@ -461,22 +463,16 @@ constexpr const char* ValidPrefixes[] = {
|
||||
|
||||
bool PrefixesValidMacroNamespace(const std::string& str)
|
||||
{
|
||||
for (auto const& prefix : ValidPrefixes) {
|
||||
if (cmHasPrefix(prefix, str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(
|
||||
std::begin(ValidPrefixes), std::end(ValidPrefixes),
|
||||
[&str](const char* prefix) -> bool { return cmHasPrefix(prefix, str); });
|
||||
}
|
||||
|
||||
bool IsValidMacroNamespace(const std::string& str)
|
||||
{
|
||||
for (auto const& prefix : ValidPrefixes) {
|
||||
if (str == prefix) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(
|
||||
std::begin(ValidPrefixes), std::end(ValidPrefixes),
|
||||
[&str](const char* prefix) -> bool { return str == prefix; });
|
||||
}
|
||||
|
||||
enum class ExpandMacroResult
|
||||
|
||||
@@ -221,8 +221,8 @@ void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
|
||||
|
||||
// Pass the call to the makefile instance.
|
||||
std::vector<std::string> no_byproducts;
|
||||
mf->AddUtilityCommand(utilityName, (all ? false : true), nullptr,
|
||||
no_byproducts, depends2, commandLines);
|
||||
mf->AddUtilityCommand(utilityName, !all, nullptr, no_byproducts, depends2,
|
||||
commandLines);
|
||||
}
|
||||
|
||||
void CCONV cmAddCustomCommand(void* arg, const char* source,
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
+10
-10
@@ -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);
|
||||
|
||||
@@ -951,6 +951,9 @@ void cmComputeLinkInformation::AddLinkExtension(std::string const& e,
|
||||
}
|
||||
}
|
||||
|
||||
// XXX(clang-tidy): This method's const-ness is platform dependent, so we
|
||||
// cannot make it `const` as `clang-tidy` wants us to.
|
||||
// NOLINTNEXTLINE(readability-make-member-function-const)
|
||||
std::string cmComputeLinkInformation::CreateExtensionRegex(
|
||||
std::vector<std::string> const& exts, LinkType type)
|
||||
{
|
||||
|
||||
@@ -12,8 +12,6 @@ cmConsoleBuf::cmConsoleBuf()
|
||||
cmConsoleBuf::cmConsoleBuf() = default;
|
||||
#endif
|
||||
|
||||
cmConsoleBuf::~cmConsoleBuf() = default;
|
||||
|
||||
void cmConsoleBuf::SetUTF8Pipes()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(CMAKE_BOOTSTRAP)
|
||||
|
||||
@@ -16,7 +16,7 @@ class cmConsoleBuf
|
||||
#endif
|
||||
public:
|
||||
cmConsoleBuf();
|
||||
~cmConsoleBuf();
|
||||
~cmConsoleBuf() = default;
|
||||
cmConsoleBuf(cmConsoleBuf const&) = delete;
|
||||
cmConsoleBuf& operator=(cmConsoleBuf const&) = delete;
|
||||
void SetUTF8Pipes();
|
||||
|
||||
@@ -77,7 +77,7 @@ bool cmDepends::Check(const std::string& makeFile,
|
||||
return okay;
|
||||
}
|
||||
|
||||
void cmDepends::Clear(const std::string& file)
|
||||
void cmDepends::Clear(const std::string& file) const
|
||||
{
|
||||
// Print verbose output.
|
||||
if (this->Verbose) {
|
||||
|
||||
+1
-2
@@ -25,7 +25,6 @@ class cmDepends
|
||||
public:
|
||||
using DependencyMap = std::map<std::string, std::vector<std::string>>;
|
||||
|
||||
public:
|
||||
/** Instances need to know the build directory name and the relative
|
||||
path from the build directory to the target file. */
|
||||
cmDepends(cmLocalUnixMakefileGenerator3* lg = nullptr,
|
||||
@@ -70,7 +69,7 @@ public:
|
||||
DependencyMap& validDeps);
|
||||
|
||||
/** Clear dependencies for the target file so they will be regenerated. */
|
||||
void Clear(const std::string& file);
|
||||
void Clear(const std::string& file) const;
|
||||
|
||||
/** Set the file comparison object */
|
||||
void SetFileTimeCache(cmFileTimeCache* fc) { this->FileTimeCache = fc; }
|
||||
|
||||
@@ -103,7 +103,7 @@ void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line,
|
||||
std::cout << "- " << strlen(str) << std::endl;
|
||||
}
|
||||
}
|
||||
void cmDependsJavaParserHelper::Print(const char* place, const char* str)
|
||||
void cmDependsJavaParserHelper::Print(const char* place, const char* str) const
|
||||
{
|
||||
if (this->Verbose) {
|
||||
std::cout << "[" << place << "=" << str << "]" << std::endl;
|
||||
|
||||
@@ -85,7 +85,7 @@ private:
|
||||
|
||||
void PrintClasses();
|
||||
|
||||
void Print(const char* place, const char* str);
|
||||
void Print(const char* place, const char* str) const;
|
||||
void CombineUnions(char** out, const char* in1, char** in2, const char* sep);
|
||||
void SafePrintMissing(const char* str, int line, int cnt);
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
void SetResult(KWIML_INT_int64_t value);
|
||||
|
||||
KWIML_INT_int64_t GetResult() { return this->Result; }
|
||||
KWIML_INT_int64_t GetResult() const { return this->Result; }
|
||||
|
||||
const char* GetError() { return this->ErrorString.c_str(); }
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -24,7 +24,6 @@ protected:
|
||||
std::string WorkspacePath;
|
||||
unsigned int CpuCount = 2;
|
||||
|
||||
protected:
|
||||
std::string GetCodeLiteCompilerName(const cmMakefile* mf) const;
|
||||
std::string GetConfigurationName(const cmMakefile* mf) const;
|
||||
std::string GetBuildCommand(const cmMakefile* mf,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -334,7 +334,7 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
|
||||
arg_limit_count,
|
||||
arg_length_minimum,
|
||||
arg_length_maximum,
|
||||
arg__maximum,
|
||||
arg_maximum,
|
||||
arg_regex,
|
||||
arg_encoding
|
||||
};
|
||||
@@ -558,8 +558,7 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
|
||||
// back subsequent characters
|
||||
if ((current_str.length() != num_utf8_bytes)) {
|
||||
for (unsigned int j = 0; j < current_str.size() - 1; j++) {
|
||||
c = current_str[current_str.size() - 1 - j];
|
||||
fin.putback(static_cast<char>(c));
|
||||
fin.putback(current_str[current_str.size() - 1 - j]);
|
||||
}
|
||||
current_str.clear();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,9 @@ bool cmFileLock::IsLocked(const std::string& filename) const
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
// NOLINTNEXTLINE(bugprone-suspicious-include)
|
||||
# include "cmFileLockWin32.cxx"
|
||||
#else
|
||||
// NOLINTNEXTLINE(bugprone-suspicious-include)
|
||||
# include "cmFileLockUnix.cxx"
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ private:
|
||||
BOOL LockFile(DWORD flags);
|
||||
#else
|
||||
int File = -1;
|
||||
int LockFile(int cmd, int type);
|
||||
int LockFile(int cmd, int type) const;
|
||||
#endif
|
||||
|
||||
std::string Filename;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmFileLockPool.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
|
||||
@@ -145,10 +146,8 @@ cmFileLockResult cmFileLockPool::ScopePool::Release(
|
||||
bool cmFileLockPool::ScopePool::IsAlreadyLocked(
|
||||
const std::string& filename) const
|
||||
{
|
||||
for (auto const& lock : this->Locks) {
|
||||
if (lock.IsLocked(filename)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(this->Locks.begin(), this->Locks.end(),
|
||||
[&filename](cmFileLock const& lock) -> bool {
|
||||
return lock.IsLocked(filename);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ cmFileLockResult cmFileLock::LockWithTimeout(unsigned long seconds)
|
||||
}
|
||||
}
|
||||
|
||||
int cmFileLock::LockFile(int cmd, int type)
|
||||
int cmFileLock::LockFile(int cmd, int type) const
|
||||
{
|
||||
struct ::flock lock;
|
||||
lock.l_start = 0;
|
||||
|
||||
@@ -1145,34 +1145,27 @@ bool cmFindPackageCommand::FindConfig()
|
||||
bool cmFindPackageCommand::FindPrefixedConfig()
|
||||
{
|
||||
std::vector<std::string> const& prefixes = this->SearchPaths;
|
||||
for (std::string const& p : prefixes) {
|
||||
if (this->SearchPrefix(p)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(
|
||||
prefixes.begin(), prefixes.end(),
|
||||
[this](std::string const& p) -> bool { return this->SearchPrefix(p); });
|
||||
}
|
||||
|
||||
bool cmFindPackageCommand::FindFrameworkConfig()
|
||||
{
|
||||
std::vector<std::string> const& prefixes = this->SearchPaths;
|
||||
for (std::string const& p : prefixes) {
|
||||
if (this->SearchFrameworkPrefix(p)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(prefixes.begin(), prefixes.end(),
|
||||
[this](std::string const& p) -> bool {
|
||||
return this->SearchFrameworkPrefix(p);
|
||||
});
|
||||
}
|
||||
|
||||
bool cmFindPackageCommand::FindAppBundleConfig()
|
||||
{
|
||||
std::vector<std::string> const& prefixes = this->SearchPaths;
|
||||
for (std::string const& p : prefixes) {
|
||||
if (this->SearchAppBundlePrefix(p)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(prefixes.begin(), prefixes.end(),
|
||||
[this](std::string const& p) -> bool {
|
||||
return this->SearchAppBundlePrefix(p);
|
||||
});
|
||||
}
|
||||
|
||||
bool cmFindPackageCommand::ReadListFile(const std::string& f,
|
||||
|
||||
@@ -80,8 +80,8 @@ std::string cmFindPathCommand::FindHeader()
|
||||
return header;
|
||||
}
|
||||
|
||||
std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file,
|
||||
std::string const& dir)
|
||||
std::string cmFindPathCommand::FindHeaderInFramework(
|
||||
std::string const& file, std::string const& dir) const
|
||||
{
|
||||
std::string fileName = file;
|
||||
std::string frameWorkName;
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
private:
|
||||
std::string FindHeaderInFramework(std::string const& file,
|
||||
std::string const& dir);
|
||||
std::string const& dir) const;
|
||||
std::string FindHeader();
|
||||
std::string FindNormalHeader(cmFindBaseDebugState& debug);
|
||||
std::string FindFrameworkHeader(cmFindBaseDebugState& debug);
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmFindProgramCommand.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmPolicies.h"
|
||||
@@ -60,44 +63,42 @@ struct cmFindProgramHelper
|
||||
}
|
||||
bool CheckCompoundNames()
|
||||
{
|
||||
for (std::string const& n : this->Names) {
|
||||
// Only perform search relative to current directory if the file name
|
||||
// contains a directory separator.
|
||||
if (n.find('/') != std::string::npos) {
|
||||
if (this->CheckDirectoryForName("", n)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(this->Names.begin(), this->Names.end(),
|
||||
[this](std::string const& n) -> bool {
|
||||
// Only perform search relative to current directory
|
||||
// if the file name contains a directory separator.
|
||||
return n.find('/') != std::string::npos &&
|
||||
this->CheckDirectoryForName("", n);
|
||||
});
|
||||
}
|
||||
bool CheckDirectory(std::string const& path)
|
||||
{
|
||||
for (std::string const& n : this->Names) {
|
||||
if (this->CheckDirectoryForName(path, n)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(this->Names.begin(), this->Names.end(),
|
||||
[this, &path](std::string const& n) -> bool {
|
||||
// Only perform search relative to current directory
|
||||
// if the file name contains a directory separator.
|
||||
return this->CheckDirectoryForName(path, n);
|
||||
});
|
||||
}
|
||||
bool CheckDirectoryForName(std::string const& path, std::string const& name)
|
||||
{
|
||||
for (std::string const& ext : this->Extensions) {
|
||||
if (!ext.empty() && cmHasSuffix(name, ext)) {
|
||||
continue;
|
||||
}
|
||||
this->TestNameExt = cmStrCat(name, ext);
|
||||
this->TestPath =
|
||||
cmSystemTools::CollapseFullPath(this->TestNameExt, path);
|
||||
bool exists = this->FileIsExecutable(this->TestPath);
|
||||
exists ? this->DebugSearches.FoundAt(this->TestPath)
|
||||
: this->DebugSearches.FailedAt(this->TestPath);
|
||||
if (exists) {
|
||||
this->BestPath = this->TestPath;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(this->Extensions.begin(), this->Extensions.end(),
|
||||
[this, &path, &name](std::string const& ext) -> bool {
|
||||
if (!ext.empty() && cmHasSuffix(name, ext)) {
|
||||
return false;
|
||||
}
|
||||
this->TestNameExt = cmStrCat(name, ext);
|
||||
this->TestPath = cmSystemTools::CollapseFullPath(
|
||||
this->TestNameExt, path);
|
||||
bool exists = this->FileIsExecutable(this->TestPath);
|
||||
exists ? this->DebugSearches.FoundAt(this->TestPath)
|
||||
: this->DebugSearches.FailedAt(this->TestPath);
|
||||
if (exists) {
|
||||
this->BestPath = this->TestPath;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
bool FileIsExecutable(std::string const& file) const
|
||||
{
|
||||
|
||||
@@ -44,7 +44,6 @@ private:
|
||||
virtual bool Replay(std::vector<cmListFileFunction> functions,
|
||||
cmExecutionStatus& status) = 0;
|
||||
|
||||
private:
|
||||
cmListFileContext StartingContext;
|
||||
std::vector<cmListFileFunction> Functions;
|
||||
unsigned int ScopeDepth = 1;
|
||||
|
||||
@@ -89,7 +89,6 @@ private:
|
||||
Result CheckGraph() const;
|
||||
void Initialize();
|
||||
|
||||
private:
|
||||
const cmGeneratorExpressionDAGChecker* const Parent;
|
||||
cmGeneratorTarget const* Target;
|
||||
const std::string Property;
|
||||
|
||||
@@ -52,7 +52,6 @@ private:
|
||||
std::string FixRelativePath(std::string const& filePath, PathRole role,
|
||||
cmLocalGenerator* lg);
|
||||
|
||||
private:
|
||||
const std::string Input;
|
||||
const std::string Target;
|
||||
const std::unique_ptr<cmCompiledGeneratorExpression> OutputFileExpr;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -108,7 +108,6 @@ private:
|
||||
std::vector<cmGeneratorExpressionEvaluatorVector>::const_iterator pit)
|
||||
const;
|
||||
|
||||
private:
|
||||
cmGeneratorExpressionEvaluatorVector IdentifierChildren;
|
||||
std::vector<cmGeneratorExpressionEvaluatorVector> ParamChildren;
|
||||
const char* StartContent;
|
||||
|
||||
@@ -24,7 +24,6 @@ private:
|
||||
void ParseContent(cmGeneratorExpressionEvaluatorVector&);
|
||||
void ParseGeneratorExpression(cmGeneratorExpressionEvaluatorVector&);
|
||||
|
||||
private:
|
||||
std::vector<cmGeneratorExpressionToken>::const_iterator it;
|
||||
const std::vector<cmGeneratorExpressionToken> Tokens;
|
||||
unsigned int NestingLevel;
|
||||
|
||||
@@ -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));
|
||||
@@ -7359,7 +7359,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;
|
||||
@@ -726,12 +726,10 @@ bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()
|
||||
}
|
||||
std::vector<cmSourceFile*> sources;
|
||||
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
|
||||
for (const cmSourceFile* sf : sources) {
|
||||
if ("int" == sf->GetExtension()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(sources.begin(), sources.end(),
|
||||
[](cmSourceFile const* sf) -> bool {
|
||||
return "int" == sf->GetExtension();
|
||||
});
|
||||
}
|
||||
|
||||
bool cmGhsMultiTargetGenerator::ComputeCustomCommandOrder(
|
||||
@@ -761,7 +759,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;
|
||||
|
||||
@@ -2675,33 +2675,35 @@ bool cmGlobalNinjaMultiGenerator::OpenBuildFileStreams()
|
||||
<< "# This file contains build statements common to all "
|
||||
"configurations.\n\n";
|
||||
|
||||
for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs(
|
||||
cmMakefile::IncludeEmptyConfig)) {
|
||||
// Open impl file.
|
||||
if (!this->OpenFileStream(this->ImplFileStreams[config],
|
||||
GetNinjaImplFilename(config))) {
|
||||
return false;
|
||||
}
|
||||
auto const& configs =
|
||||
this->Makefiles[0]->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
return std::all_of(
|
||||
configs.begin(), configs.end(), [this](std::string const& config) -> bool {
|
||||
// Open impl file.
|
||||
if (!this->OpenFileStream(this->ImplFileStreams[config],
|
||||
GetNinjaImplFilename(config))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Write a comment about this file.
|
||||
*this->ImplFileStreams[config]
|
||||
<< "# This file contains build statements specific to the \"" << config
|
||||
<< "\"\n# configuration.\n\n";
|
||||
// Write a comment about this file.
|
||||
*this->ImplFileStreams[config]
|
||||
<< "# This file contains build statements specific to the \"" << config
|
||||
<< "\"\n# configuration.\n\n";
|
||||
|
||||
// Open config file.
|
||||
if (!this->OpenFileStream(this->ConfigFileStreams[config],
|
||||
GetNinjaConfigFilename(config))) {
|
||||
return false;
|
||||
}
|
||||
// Open config file.
|
||||
if (!this->OpenFileStream(this->ConfigFileStreams[config],
|
||||
GetNinjaConfigFilename(config))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Write a comment about this file.
|
||||
*this->ConfigFileStreams[config]
|
||||
<< "# This file contains aliases specific to the \"" << config
|
||||
<< "\"\n# configuration.\n\n"
|
||||
<< "include " << GetNinjaImplFilename(config) << "\n\n";
|
||||
}
|
||||
// Write a comment about this file.
|
||||
*this->ConfigFileStreams[config]
|
||||
<< "# This file contains aliases specific to the \"" << config
|
||||
<< "\"\n# configuration.\n\n"
|
||||
<< "include " << GetNinjaImplFilename(config) << "\n\n";
|
||||
|
||||
return true;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
void cmGlobalNinjaMultiGenerator::CloseBuildFileStreams()
|
||||
|
||||
@@ -152,7 +152,6 @@ public:
|
||||
|
||||
bool IsGCCOnWindows() const { return this->UsingGCCOnWindows; }
|
||||
|
||||
public:
|
||||
cmGlobalNinjaGenerator(cmake* cm);
|
||||
|
||||
static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
|
||||
@@ -570,7 +569,6 @@ private:
|
||||
|
||||
bool DiagnosedCxxModuleSupport = false;
|
||||
|
||||
private:
|
||||
void InitOutputPathPrefix();
|
||||
|
||||
std::string OutputPathPrefix;
|
||||
|
||||
@@ -134,13 +134,13 @@ public:
|
||||
std::set<std::string>& emitted);
|
||||
|
||||
// Make tool supports dependency files generated by compiler
|
||||
bool SupportsCompilerDependencies()
|
||||
bool SupportsCompilerDependencies() const
|
||||
{
|
||||
return this->ToolSupportsCompilerDependencies;
|
||||
}
|
||||
|
||||
// Make tool supports long line dependencies
|
||||
bool SupportsLongLineDependencies()
|
||||
bool SupportsLongLineDependencies() const
|
||||
{
|
||||
return this->ToolSupportsLongLineDependencies;
|
||||
}
|
||||
|
||||
+19
-19
@@ -230,7 +230,7 @@ void cmGraphVizWriter::ReadSettings(
|
||||
|
||||
std::cout << "Reading GraphViz options file: " << inFileName << std::endl;
|
||||
|
||||
#define __set_if_set(var, cmakeDefinition) \
|
||||
#define set_if_set(var, cmakeDefinition) \
|
||||
do { \
|
||||
cmProp value = mf.GetDefinition(cmakeDefinition); \
|
||||
if (value) { \
|
||||
@@ -238,11 +238,11 @@ void cmGraphVizWriter::ReadSettings(
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
__set_if_set(this->GraphName, "GRAPHVIZ_GRAPH_NAME");
|
||||
__set_if_set(this->GraphHeader, "GRAPHVIZ_GRAPH_HEADER");
|
||||
__set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX");
|
||||
set_if_set(this->GraphName, "GRAPHVIZ_GRAPH_NAME");
|
||||
set_if_set(this->GraphHeader, "GRAPHVIZ_GRAPH_HEADER");
|
||||
set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX");
|
||||
|
||||
#define __set_bool_if_set(var, cmakeDefinition) \
|
||||
#define set_bool_if_set(var, cmakeDefinition) \
|
||||
do { \
|
||||
cmProp value = mf.GetDefinition(cmakeDefinition); \
|
||||
if (value) { \
|
||||
@@ -250,20 +250,20 @@ void cmGraphVizWriter::ReadSettings(
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
__set_bool_if_set(this->GenerateForExecutables, "GRAPHVIZ_EXECUTABLES");
|
||||
__set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS");
|
||||
__set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS");
|
||||
__set_bool_if_set(this->GenerateForModuleLibs, "GRAPHVIZ_MODULE_LIBS");
|
||||
__set_bool_if_set(this->GenerateForInterfaceLibs, "GRAPHVIZ_INTERFACE_LIBS");
|
||||
__set_bool_if_set(this->GenerateForObjectLibs, "GRAPHVIZ_OBJECT_LIBS");
|
||||
__set_bool_if_set(this->GenerateForUnknownLibs, "GRAPHVIZ_UNKNOWN_LIBS");
|
||||
__set_bool_if_set(this->GenerateForCustomTargets, "GRAPHVIZ_CUSTOM_TARGETS");
|
||||
__set_bool_if_set(this->GenerateForExternals, "GRAPHVIZ_EXTERNAL_LIBS");
|
||||
__set_bool_if_set(this->GeneratePerTarget, "GRAPHVIZ_GENERATE_PER_TARGET");
|
||||
__set_bool_if_set(this->GenerateDependers, "GRAPHVIZ_GENERATE_DEPENDERS");
|
||||
set_bool_if_set(this->GenerateForExecutables, "GRAPHVIZ_EXECUTABLES");
|
||||
set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS");
|
||||
set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS");
|
||||
set_bool_if_set(this->GenerateForModuleLibs, "GRAPHVIZ_MODULE_LIBS");
|
||||
set_bool_if_set(this->GenerateForInterfaceLibs, "GRAPHVIZ_INTERFACE_LIBS");
|
||||
set_bool_if_set(this->GenerateForObjectLibs, "GRAPHVIZ_OBJECT_LIBS");
|
||||
set_bool_if_set(this->GenerateForUnknownLibs, "GRAPHVIZ_UNKNOWN_LIBS");
|
||||
set_bool_if_set(this->GenerateForCustomTargets, "GRAPHVIZ_CUSTOM_TARGETS");
|
||||
set_bool_if_set(this->GenerateForExternals, "GRAPHVIZ_EXTERNAL_LIBS");
|
||||
set_bool_if_set(this->GeneratePerTarget, "GRAPHVIZ_GENERATE_PER_TARGET");
|
||||
set_bool_if_set(this->GenerateDependers, "GRAPHVIZ_GENERATE_DEPENDERS");
|
||||
|
||||
std::string ignoreTargetsRegexes;
|
||||
__set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS");
|
||||
set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS");
|
||||
|
||||
this->TargetsToIgnoreRegex.clear();
|
||||
if (!ignoreTargetsRegexes.empty()) {
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+52
-36
@@ -57,28 +57,38 @@ public:
|
||||
bool MakeFilesFullPath(const char* modeName,
|
||||
const std::vector<std::string>& relFiles,
|
||||
std::vector<std::string>& absFiles);
|
||||
bool CheckCMP0006(bool& failure);
|
||||
bool CheckCMP0006(bool& failure) const;
|
||||
|
||||
std::string GetDestination(const cmInstallCommandArguments* args,
|
||||
const std::string& varName,
|
||||
const std::string& guess);
|
||||
std::string GetRuntimeDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetSbinDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetArchiveDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetLibraryDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetIncludeDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetSysconfDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetSharedStateDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetLocalStateDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetRunStateDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetDataRootDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetDataDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetInfoDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetLocaleDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetManDestination(const cmInstallCommandArguments* args);
|
||||
std::string GetDocDestination(const cmInstallCommandArguments* args);
|
||||
const std::string& guess) const;
|
||||
std::string GetRuntimeDestination(
|
||||
const cmInstallCommandArguments* args) const;
|
||||
std::string GetSbinDestination(const cmInstallCommandArguments* args) const;
|
||||
std::string GetArchiveDestination(
|
||||
const cmInstallCommandArguments* args) const;
|
||||
std::string GetLibraryDestination(
|
||||
const cmInstallCommandArguments* args) const;
|
||||
std::string GetIncludeDestination(
|
||||
const cmInstallCommandArguments* args) const;
|
||||
std::string GetSysconfDestination(
|
||||
const cmInstallCommandArguments* args) const;
|
||||
std::string GetSharedStateDestination(
|
||||
const cmInstallCommandArguments* args) const;
|
||||
std::string GetLocalStateDestination(
|
||||
const cmInstallCommandArguments* args) const;
|
||||
std::string GetRunStateDestination(
|
||||
const cmInstallCommandArguments* args) const;
|
||||
std::string GetDataRootDestination(
|
||||
const cmInstallCommandArguments* args) const;
|
||||
std::string GetDataDestination(const cmInstallCommandArguments* args) const;
|
||||
std::string GetInfoDestination(const cmInstallCommandArguments* args) const;
|
||||
std::string GetLocaleDestination(
|
||||
const cmInstallCommandArguments* args) const;
|
||||
std::string GetManDestination(const cmInstallCommandArguments* args) const;
|
||||
std::string GetDocDestination(const cmInstallCommandArguments* args) const;
|
||||
std::string GetDestinationForType(const cmInstallCommandArguments* args,
|
||||
const std::string& type);
|
||||
const std::string& type) const;
|
||||
|
||||
cmExecutionStatus& Status;
|
||||
cmMakefile* Makefile;
|
||||
@@ -1477,7 +1487,7 @@ bool Helper::MakeFilesFullPath(const char* modeName,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Helper::CheckCMP0006(bool& failure)
|
||||
bool Helper::CheckCMP0006(bool& failure) const
|
||||
{
|
||||
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0006)) {
|
||||
case cmPolicies::WARN:
|
||||
@@ -1504,7 +1514,7 @@ bool Helper::CheckCMP0006(bool& failure)
|
||||
|
||||
std::string Helper::GetDestination(const cmInstallCommandArguments* args,
|
||||
const std::string& varName,
|
||||
const std::string& guess)
|
||||
const std::string& guess) const
|
||||
{
|
||||
if (args && !args->GetDestination().empty()) {
|
||||
return args->GetDestination();
|
||||
@@ -1517,54 +1527,55 @@ std::string Helper::GetDestination(const cmInstallCommandArguments* args,
|
||||
}
|
||||
|
||||
std::string Helper::GetRuntimeDestination(
|
||||
const cmInstallCommandArguments* args)
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_BINDIR", "bin");
|
||||
}
|
||||
|
||||
std::string Helper::GetSbinDestination(const cmInstallCommandArguments* args)
|
||||
std::string Helper::GetSbinDestination(
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_SBINDIR", "sbin");
|
||||
}
|
||||
|
||||
std::string Helper::GetArchiveDestination(
|
||||
const cmInstallCommandArguments* args)
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_LIBDIR", "lib");
|
||||
}
|
||||
|
||||
std::string Helper::GetLibraryDestination(
|
||||
const cmInstallCommandArguments* args)
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_LIBDIR", "lib");
|
||||
}
|
||||
|
||||
std::string Helper::GetIncludeDestination(
|
||||
const cmInstallCommandArguments* args)
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_INCLUDEDIR", "include");
|
||||
}
|
||||
|
||||
std::string Helper::GetSysconfDestination(
|
||||
const cmInstallCommandArguments* args)
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_SYSCONFDIR", "etc");
|
||||
}
|
||||
|
||||
std::string Helper::GetSharedStateDestination(
|
||||
const cmInstallCommandArguments* args)
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_SHAREDSTATEDIR", "com");
|
||||
}
|
||||
|
||||
std::string Helper::GetLocalStateDestination(
|
||||
const cmInstallCommandArguments* args)
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_LOCALSTATEDIR", "var");
|
||||
}
|
||||
|
||||
std::string Helper::GetRunStateDestination(
|
||||
const cmInstallCommandArguments* args)
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_RUNSTATEDIR",
|
||||
this->GetLocalStateDestination(nullptr) +
|
||||
@@ -1572,44 +1583,49 @@ std::string Helper::GetRunStateDestination(
|
||||
}
|
||||
|
||||
std::string Helper::GetDataRootDestination(
|
||||
const cmInstallCommandArguments* args)
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_DATAROOTDIR", "share");
|
||||
}
|
||||
|
||||
std::string Helper::GetDataDestination(const cmInstallCommandArguments* args)
|
||||
std::string Helper::GetDataDestination(
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_DATADIR",
|
||||
this->GetDataRootDestination(nullptr));
|
||||
}
|
||||
|
||||
std::string Helper::GetInfoDestination(const cmInstallCommandArguments* args)
|
||||
std::string Helper::GetInfoDestination(
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_INFODIR",
|
||||
this->GetDataRootDestination(nullptr) + "/info");
|
||||
}
|
||||
|
||||
std::string Helper::GetLocaleDestination(const cmInstallCommandArguments* args)
|
||||
std::string Helper::GetLocaleDestination(
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_LOCALEDIR",
|
||||
this->GetDataRootDestination(nullptr) +
|
||||
"/locale");
|
||||
}
|
||||
|
||||
std::string Helper::GetManDestination(const cmInstallCommandArguments* args)
|
||||
std::string Helper::GetManDestination(
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_MANDIR",
|
||||
this->GetDataRootDestination(nullptr) + "/man");
|
||||
}
|
||||
|
||||
std::string Helper::GetDocDestination(const cmInstallCommandArguments* args)
|
||||
std::string Helper::GetDocDestination(
|
||||
const cmInstallCommandArguments* args) const
|
||||
{
|
||||
return this->GetDestination(args, "CMAKE_INSTALL_DOCDIR",
|
||||
this->GetDataRootDestination(nullptr) + "/doc");
|
||||
}
|
||||
|
||||
std::string Helper::GetDestinationForType(
|
||||
const cmInstallCommandArguments* args, const std::string& type)
|
||||
const cmInstallCommandArguments* args, const std::string& type) const
|
||||
{
|
||||
if (args && !args->GetDestination().empty()) {
|
||||
return args->GetDestination();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmInstallCommandArguments.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include <cmext/string_view>
|
||||
@@ -176,13 +177,11 @@ bool cmInstallCommandArguments::Finalize()
|
||||
bool cmInstallCommandArguments::CheckPermissions()
|
||||
{
|
||||
this->PermissionsString.clear();
|
||||
for (std::string const& perm : this->Permissions) {
|
||||
if (!cmInstallCommandArguments::CheckPermissions(
|
||||
perm, this->PermissionsString)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return std::all_of(this->Permissions.begin(), this->Permissions.end(),
|
||||
[this](std::string const& perm) -> bool {
|
||||
return cmInstallCommandArguments::CheckPermissions(
|
||||
perm, this->PermissionsString);
|
||||
});
|
||||
}
|
||||
|
||||
bool cmInstallCommandArguments::CheckPermissions(
|
||||
|
||||
@@ -53,9 +53,8 @@ bool cmInstallScriptGenerator::Compute(cmLocalGenerator* lg)
|
||||
return true;
|
||||
}
|
||||
|
||||
void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os,
|
||||
Indent indent,
|
||||
std::string const& script)
|
||||
void cmInstallScriptGenerator::AddScriptInstallRule(
|
||||
std::ostream& os, Indent indent, std::string const& script) const
|
||||
{
|
||||
if (this->Code) {
|
||||
os << indent << script << "\n";
|
||||
|
||||
@@ -30,7 +30,7 @@ protected:
|
||||
void GenerateScriptForConfig(std::ostream& os, const std::string& config,
|
||||
Indent indent) override;
|
||||
void AddScriptInstallRule(std::ostream& os, Indent indent,
|
||||
std::string const& script);
|
||||
std::string const& script) const;
|
||||
|
||||
std::string const Script;
|
||||
bool const Code;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "cmLinkLineDeviceComputer.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
@@ -57,17 +58,15 @@ bool cmLinkLineDeviceComputer::ComputeRequiresDeviceLinking(
|
||||
using ItemVector = cmComputeLinkInformation::ItemVector;
|
||||
ItemVector const& items = cli.GetItems();
|
||||
std::string config = cli.GetConfig();
|
||||
for (auto const& item : items) {
|
||||
if (item.Target &&
|
||||
item.Target->GetType() == cmStateEnums::STATIC_LIBRARY) {
|
||||
if ((!item.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS")) &&
|
||||
item.Target->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION")) {
|
||||
return std::any_of(
|
||||
items.begin(), items.end(),
|
||||
[](cmComputeLinkInformation::Item const& item) -> bool {
|
||||
return item.Target &&
|
||||
item.Target->GetType() == cmStateEnums::STATIC_LIBRARY &&
|
||||
// this dependency requires us to device link it
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
!item.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS") &&
|
||||
item.Target->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION");
|
||||
});
|
||||
}
|
||||
|
||||
void cmLinkLineDeviceComputer::ComputeLinkLibraries(
|
||||
|
||||
@@ -30,7 +30,7 @@ struct cmListFileParser
|
||||
bool ParseFunction(const char* name, long line);
|
||||
bool AddArgument(cmListFileLexer_Token* token,
|
||||
cmListFileArgument::Delimiter delim);
|
||||
cm::optional<cmListFileContext> CheckNesting();
|
||||
cm::optional<cmListFileContext> CheckNesting() const;
|
||||
cmListFile* ListFile;
|
||||
cmListFileBacktrace Backtrace;
|
||||
cmMessenger* Messenger;
|
||||
@@ -352,7 +352,7 @@ bool TopIs(std::vector<NestingState>& stack, NestingStateEnum state)
|
||||
}
|
||||
}
|
||||
|
||||
cm::optional<cmListFileContext> cmListFileParser::CheckNesting()
|
||||
cm::optional<cmListFileContext> cmListFileParser::CheckNesting() const
|
||||
{
|
||||
std::vector<NestingState> stack;
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
|
||||
#if !defined(_WIN32) && !defined(__sun)
|
||||
// POSIX APIs are needed
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier)
|
||||
# define _POSIX_C_SOURCE 200809L
|
||||
#endif
|
||||
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
// For isascii
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier)
|
||||
# define _XOPEN_SOURCE 700
|
||||
#endif
|
||||
|
||||
@@ -31,6 +33,7 @@
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
// NOLINTNEXTLINE(bugprone-suspicious-include)
|
||||
#include "cmCPluginAPI.cxx"
|
||||
|
||||
#ifdef __QNX__
|
||||
|
||||
+23
-31
@@ -1853,17 +1853,12 @@ bool cmLocalGenerator::AllAppleArchSysrootsAreTheSame(
|
||||
return false;
|
||||
}
|
||||
|
||||
for (std::string const& arch : archs) {
|
||||
std::string const& archSysroot = this->AppleArchSysroots[arch];
|
||||
if (cmIsOff(archSysroot)) {
|
||||
continue;
|
||||
}
|
||||
if (archSysroot != sysroot) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return std::all_of(archs.begin(), archs.end(),
|
||||
[this, &sysroot](std::string const& arch) -> bool {
|
||||
std::string const& archSysroot =
|
||||
this->AppleArchSysroots[arch];
|
||||
return cmIsOff(archSysroot) || archSysroot == sysroot;
|
||||
});
|
||||
}
|
||||
|
||||
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
|
||||
@@ -2553,7 +2548,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 +2565,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 +2628,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);
|
||||
@@ -2772,7 +2767,7 @@ inline void RegisterUnitySources(cmGeneratorTarget* target, cmSourceFile* sf,
|
||||
|
||||
void cmLocalGenerator::IncludeFileInUnitySources(
|
||||
cmGeneratedFileStream& unity_file, std::string const& sf_full_path,
|
||||
cmProp beforeInclude, cmProp afterInclude, cmProp uniqueIdName)
|
||||
cmProp beforeInclude, cmProp afterInclude, cmProp uniqueIdName) const
|
||||
{
|
||||
if (uniqueIdName && !uniqueIdName->empty()) {
|
||||
std::string pathToHash;
|
||||
@@ -2961,7 +2956,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());
|
||||
@@ -4039,26 +4034,23 @@ cmSourceFile* AddCustomCommand(
|
||||
bool AnyOutputMatches(const std::string& name,
|
||||
const std::vector<std::string>& outputs)
|
||||
{
|
||||
for (std::string const& output : outputs) {
|
||||
std::string::size_type pos = output.rfind(name);
|
||||
// If the output matches exactly
|
||||
if (pos != std::string::npos && pos == output.size() - name.size() &&
|
||||
(pos == 0 || output[pos - 1] == '/')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(outputs.begin(), outputs.end(),
|
||||
[&name](std::string const& output) -> bool {
|
||||
std::string::size_type pos = output.rfind(name);
|
||||
// If the output matches exactly
|
||||
return (pos != std::string::npos &&
|
||||
pos == output.size() - name.size() &&
|
||||
(pos == 0 || output[pos - 1] == '/'));
|
||||
});
|
||||
}
|
||||
|
||||
bool AnyTargetCommandOutputMatches(
|
||||
const std::string& name, const std::vector<cmCustomCommand>& commands)
|
||||
{
|
||||
for (cmCustomCommand const& command : commands) {
|
||||
if (AnyOutputMatches(name, command.GetByproducts())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(commands.begin(), commands.end(),
|
||||
[&name](cmCustomCommand const& command) -> bool {
|
||||
return AnyOutputMatches(name, command.GetByproducts());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -656,7 +656,7 @@ private:
|
||||
void IncludeFileInUnitySources(cmGeneratedFileStream& unity_file,
|
||||
std::string const& sf_full_path,
|
||||
cmProp beforeInclude, cmProp afterInclude,
|
||||
cmProp uniqueIdName);
|
||||
cmProp uniqueIdName) const;
|
||||
std::vector<std::string> AddUnityFilesModeAuto(
|
||||
cmGeneratorTarget* target, std::string const& lang,
|
||||
std::vector<cmSourceFile*> const& filtered_sources, cmProp beforeInclude,
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
|
||||
cmMakefile* mf)
|
||||
: cmLocalCommonGenerator(gg, mf, mf->GetState()->GetBinaryDirectory())
|
||||
, HomeRelativeOutputPath("")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ private:
|
||||
std::vector<std::string> ComputeLinkCmd(const std::string& config);
|
||||
std::vector<std::string> ComputeDeviceLinkCmd();
|
||||
|
||||
private:
|
||||
// Target name info.
|
||||
cmGeneratorTarget::Names TargetNames(const std::string& config) const;
|
||||
std::string TargetLinkLanguage(const std::string& config) const;
|
||||
|
||||
@@ -62,7 +62,6 @@ public:
|
||||
private:
|
||||
bool MustSkip();
|
||||
|
||||
private:
|
||||
cmGeneratorTarget* GT;
|
||||
cmMakefile* Makefile;
|
||||
cmLocalGenerator* LocalGenerator;
|
||||
|
||||
@@ -121,7 +121,7 @@ std::string cmOutputConverter::EscapeForShell(
|
||||
flags |= Shell_Flag_IsUnix;
|
||||
}
|
||||
|
||||
return Shell__GetArgument(str, flags);
|
||||
return Shell_GetArgument(str, flags);
|
||||
}
|
||||
|
||||
std::string cmOutputConverter::EscapeForCMake(cm::string_view str)
|
||||
@@ -150,7 +150,7 @@ std::string cmOutputConverter::EscapeForCMake(cm::string_view str)
|
||||
std::string cmOutputConverter::EscapeWindowsShellArgument(cm::string_view arg,
|
||||
int shell_flags)
|
||||
{
|
||||
return Shell__GetArgument(arg, shell_flags);
|
||||
return Shell_GetArgument(arg, shell_flags);
|
||||
}
|
||||
|
||||
cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
|
||||
@@ -226,12 +226,12 @@ use the caret character itself (^), use two in a row (^^).
|
||||
*/
|
||||
|
||||
/* Some helpers to identify character classes */
|
||||
static bool Shell__CharIsWhitespace(char c)
|
||||
static bool Shell_CharIsWhitespace(char c)
|
||||
{
|
||||
return ((c == ' ') || (c == '\t'));
|
||||
}
|
||||
|
||||
static bool Shell__CharNeedsQuotesOnUnix(char c)
|
||||
static bool Shell_CharNeedsQuotesOnUnix(char c)
|
||||
{
|
||||
return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') ||
|
||||
(c == '&') || (c == '$') || (c == '(') || (c == ')') || (c == '~') ||
|
||||
@@ -239,18 +239,18 @@ static bool Shell__CharNeedsQuotesOnUnix(char c)
|
||||
(c == '\\'));
|
||||
}
|
||||
|
||||
static bool Shell__CharNeedsQuotesOnWindows(char c)
|
||||
static bool Shell_CharNeedsQuotesOnWindows(char c)
|
||||
{
|
||||
return ((c == '\'') || (c == '#') || (c == '&') || (c == '<') ||
|
||||
(c == '>') || (c == '|') || (c == '^'));
|
||||
}
|
||||
|
||||
static bool Shell__CharIsMakeVariableName(char c)
|
||||
static bool Shell_CharIsMakeVariableName(char c)
|
||||
{
|
||||
return c && (c == '_' || isalpha((static_cast<int>(c))));
|
||||
}
|
||||
|
||||
bool cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags)
|
||||
bool cmOutputConverter::Shell_CharNeedsQuotes(char c, int flags)
|
||||
{
|
||||
/* On Windows the built-in command shell echo never needs quotes. */
|
||||
if (!(flags & Shell_Flag_IsUnix) && (flags & Shell_Flag_EchoWindows)) {
|
||||
@@ -258,30 +258,30 @@ bool cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags)
|
||||
}
|
||||
|
||||
/* On all platforms quotes are needed to preserve whitespace. */
|
||||
if (Shell__CharIsWhitespace(c)) {
|
||||
if (Shell_CharIsWhitespace(c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (flags & Shell_Flag_IsUnix) {
|
||||
/* On UNIX several special characters need quotes to preserve them. */
|
||||
if (Shell__CharNeedsQuotesOnUnix(c)) {
|
||||
if (Shell_CharNeedsQuotesOnUnix(c)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
/* On Windows several special characters need quotes to preserve them. */
|
||||
if (Shell__CharNeedsQuotesOnWindows(c)) {
|
||||
if (Shell_CharNeedsQuotesOnWindows(c)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cm::string_view::iterator cmOutputConverter::Shell__SkipMakeVariables(
|
||||
cm::string_view::iterator cmOutputConverter::Shell_SkipMakeVariables(
|
||||
cm::string_view::iterator c, cm::string_view::iterator end)
|
||||
{
|
||||
while ((c != end && (c + 1) != end) && (*c == '$' && *(c + 1) == '(')) {
|
||||
cm::string_view::iterator skip = c + 2;
|
||||
while ((skip != end) && Shell__CharIsMakeVariableName(*skip)) {
|
||||
while ((skip != end) && Shell_CharIsMakeVariableName(*skip)) {
|
||||
++skip;
|
||||
}
|
||||
if ((skip != end) && *skip == ')') {
|
||||
@@ -316,8 +316,8 @@ flag later when we understand applications of this better.
|
||||
*/
|
||||
#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0
|
||||
|
||||
bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in,
|
||||
int flags)
|
||||
bool cmOutputConverter::Shell_ArgumentNeedsQuotes(cm::string_view in,
|
||||
int flags)
|
||||
{
|
||||
/* The empty string needs quotes. */
|
||||
if (in.empty()) {
|
||||
@@ -330,7 +330,7 @@ bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in,
|
||||
/* Look for $(MAKEVAR) syntax if requested. */
|
||||
if (flags & Shell_Flag_AllowMakeVariables) {
|
||||
#if KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES
|
||||
cm::string_view::iterator skip = Shell__SkipMakeVariables(cit, cend);
|
||||
cm::string_view::iterator skip = Shell_SkipMakeVariables(cit, cend);
|
||||
if (skip != cit) {
|
||||
/* We need to quote make variable references to preserve the
|
||||
string with contents substituted in its place. */
|
||||
@@ -338,7 +338,7 @@ bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in,
|
||||
}
|
||||
#else
|
||||
/* Skip over the make variable references if any are present. */
|
||||
cit = Shell__SkipMakeVariables(cit, cend);
|
||||
cit = Shell_SkipMakeVariables(cit, cend);
|
||||
|
||||
/* Stop if we have reached the end of the string. */
|
||||
if (cit == cend) {
|
||||
@@ -348,7 +348,7 @@ bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in,
|
||||
}
|
||||
|
||||
/* Check whether this character needs quotes. */
|
||||
if (Shell__CharNeedsQuotes(*cit, flags)) {
|
||||
if (Shell_CharNeedsQuotes(*cit, flags)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -364,8 +364,7 @@ bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in,
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string cmOutputConverter::Shell__GetArgument(cm::string_view in,
|
||||
int flags)
|
||||
std::string cmOutputConverter::Shell_GetArgument(cm::string_view in, int flags)
|
||||
{
|
||||
/* Output will be at least as long as input string. */
|
||||
std::string out;
|
||||
@@ -375,7 +374,7 @@ std::string cmOutputConverter::Shell__GetArgument(cm::string_view in,
|
||||
int windows_backslashes = 0;
|
||||
|
||||
/* Whether the argument must be quoted. */
|
||||
int needQuotes = Shell__ArgumentNeedsQuotes(in, flags);
|
||||
int needQuotes = Shell_ArgumentNeedsQuotes(in, flags);
|
||||
if (needQuotes) {
|
||||
/* Add the opening quote for this argument. */
|
||||
if (flags & Shell_Flag_WatcomQuote) {
|
||||
@@ -393,7 +392,7 @@ std::string cmOutputConverter::Shell__GetArgument(cm::string_view in,
|
||||
cit != cend; ++cit) {
|
||||
/* Look for $(MAKEVAR) syntax if requested. */
|
||||
if (flags & Shell_Flag_AllowMakeVariables) {
|
||||
cm::string_view::iterator skip = Shell__SkipMakeVariables(cit, cend);
|
||||
cm::string_view::iterator skip = Shell_SkipMakeVariables(cit, cend);
|
||||
if (skip != cit) {
|
||||
/* Copy to the end of the make variable references. */
|
||||
while (cit != skip) {
|
||||
|
||||
@@ -105,13 +105,12 @@ public:
|
||||
private:
|
||||
cmState* GetState() const;
|
||||
|
||||
static bool Shell__CharNeedsQuotes(char c, int flags);
|
||||
static cm::string_view::iterator Shell__SkipMakeVariables(
|
||||
static bool Shell_CharNeedsQuotes(char c, int flags);
|
||||
static cm::string_view::iterator Shell_SkipMakeVariables(
|
||||
cm::string_view::iterator begin, cm::string_view::iterator end);
|
||||
static bool Shell__ArgumentNeedsQuotes(cm::string_view in, int flags);
|
||||
static std::string Shell__GetArgument(cm::string_view in, int flags);
|
||||
static bool Shell_ArgumentNeedsQuotes(cm::string_view in, int flags);
|
||||
static std::string Shell_GetArgument(cm::string_view in, int flags);
|
||||
|
||||
private:
|
||||
cmStateSnapshot StateSnapshot;
|
||||
|
||||
bool LinkScriptShell;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -51,8 +51,6 @@ cmProcessOutput::cmProcessOutput(Encoding encoding, unsigned int maxSize)
|
||||
#endif
|
||||
}
|
||||
|
||||
cmProcessOutput::~cmProcessOutput() = default;
|
||||
|
||||
bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded,
|
||||
size_t id)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
* 0 as \a maxSize.
|
||||
*/
|
||||
cmProcessOutput(Encoding encoding = Auto, unsigned int maxSize = 1024);
|
||||
~cmProcessOutput();
|
||||
~cmProcessOutput() = default;
|
||||
/**
|
||||
* Decode \a raw string using external encoding to internal
|
||||
* encoding in \a decoded.
|
||||
|
||||
@@ -64,7 +64,6 @@ public:
|
||||
/// @brief Maximum number of parallel threads/processes in a generator
|
||||
static unsigned int const ParallelMax;
|
||||
|
||||
public:
|
||||
/// @brief Returns the generator name
|
||||
static cm::string_view GeneratorName(GenT genType);
|
||||
/// @brief Returns the generator name in upper case
|
||||
|
||||
@@ -45,7 +45,6 @@ public:
|
||||
std::string ui;
|
||||
};
|
||||
|
||||
public:
|
||||
cmQtAutoGenGlobalInitializer(
|
||||
std::vector<std::unique_ptr<cmLocalGenerator>> const& localGenerators);
|
||||
~cmQtAutoGenGlobalInitializer();
|
||||
@@ -73,7 +72,6 @@ private:
|
||||
std::string const& generator, std::string const& executable,
|
||||
std::string& error);
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<cmQtAutoGenInitializer>> Initializers_;
|
||||
std::map<cmLocalGenerator*, std::string> GlobalAutoGenTargets_;
|
||||
std::map<cmLocalGenerator*, std::string> GlobalAutoRccTargets_;
|
||||
|
||||
@@ -98,7 +98,6 @@ public:
|
||||
, GenNameUpper(cmQtAutoGen::GeneratorNameUpper(gen)){};
|
||||
};
|
||||
|
||||
public:
|
||||
/** @return The detected Qt version and the required Qt major version. */
|
||||
static std::pair<IntegerVersion, unsigned int> GetQtVersion(
|
||||
cmGeneratorTarget const* genTarget);
|
||||
@@ -149,7 +148,6 @@ private:
|
||||
bool GetQtExecutable(GenVarsT& genVars, const std::string& executable,
|
||||
bool ignoreMissingTarget) const;
|
||||
|
||||
private:
|
||||
cmQtAutoGenGlobalInitializer* GlobalInitializer = nullptr;
|
||||
cmGeneratorTarget* GenTarget = nullptr;
|
||||
cmGlobalGenerator* GlobalGen = nullptr;
|
||||
|
||||
@@ -36,8 +36,6 @@ cmQtAutoGenerator::Logger::Logger()
|
||||
}
|
||||
}
|
||||
|
||||
cmQtAutoGenerator::Logger::~Logger() = default;
|
||||
|
||||
void cmQtAutoGenerator::Logger::RaiseVerbosity(unsigned int value)
|
||||
{
|
||||
if (this->Verbosity_ < value) {
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
public:
|
||||
// -- Construction
|
||||
Logger();
|
||||
~Logger();
|
||||
~Logger() = default;
|
||||
// -- Verbosity
|
||||
unsigned int Verbosity() const { return this->Verbosity_; }
|
||||
void SetVerbosity(unsigned int value) { this->Verbosity_ = value; }
|
||||
@@ -54,7 +54,6 @@ public:
|
||||
private:
|
||||
static std::string HeadLine(cm::string_view title);
|
||||
|
||||
private:
|
||||
mutable std::mutex Mutex_;
|
||||
unsigned int Verbosity_ = 0;
|
||||
bool ColorOutput_ = false;
|
||||
@@ -79,7 +78,6 @@ public:
|
||||
static bool FileDiffers(std::string const& filename,
|
||||
std::string const& content);
|
||||
|
||||
public:
|
||||
// -- Constructors
|
||||
cmQtAutoGenerator(GenT genType);
|
||||
virtual ~cmQtAutoGenerator();
|
||||
@@ -140,7 +138,6 @@ public:
|
||||
private:
|
||||
std::string ConfigKey(cm::string_view key) const;
|
||||
|
||||
private:
|
||||
Json::Value Json_;
|
||||
cmQtAutoGenerator& Gen_;
|
||||
};
|
||||
|
||||
+31
-39
@@ -55,7 +55,6 @@ public:
|
||||
cmQtAutoMocUicT(cmQtAutoMocUicT const&) = delete;
|
||||
cmQtAutoMocUicT& operator=(cmQtAutoMocUicT const&) = delete;
|
||||
|
||||
public:
|
||||
// -- Types
|
||||
|
||||
/** Include string with sub parts. */
|
||||
@@ -112,7 +111,6 @@ public:
|
||||
using FileHandleT = std::shared_ptr<FileT>;
|
||||
using GetOrInsertT = std::pair<FileHandleT, bool>;
|
||||
|
||||
public:
|
||||
ParseCacheT();
|
||||
~ParseCacheT();
|
||||
|
||||
@@ -135,7 +133,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
std::string FileName;
|
||||
cmFileTime FileTime;
|
||||
ParseCacheT::FileHandleT ParseData;
|
||||
@@ -266,7 +263,6 @@ public:
|
||||
std::vector<std::string> Options;
|
||||
};
|
||||
|
||||
public:
|
||||
UicSettingsT();
|
||||
~UicSettingsT();
|
||||
|
||||
@@ -379,7 +375,6 @@ public:
|
||||
void MocIncludes();
|
||||
void UicIncludes();
|
||||
|
||||
protected:
|
||||
SourceFileHandleT FileHandle;
|
||||
std::string Content;
|
||||
};
|
||||
@@ -572,7 +567,6 @@ private:
|
||||
static std::vector<std::string> dependenciesFromDepFile(
|
||||
const char* filePath);
|
||||
|
||||
private:
|
||||
// -- Settings
|
||||
BaseSettingsT BaseConst_;
|
||||
BaseEvalT BaseEval_;
|
||||
@@ -1432,13 +1426,12 @@ bool cmQtAutoMocUicT::JobEvalCacheMocT::FindIncludedHeader(
|
||||
return true;
|
||||
}
|
||||
// Search in include directories
|
||||
for (std::string const& path : this->MocConst().IncludePaths) {
|
||||
if (findHeader(cmStrCat(path, '/', includeBase))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Return without success
|
||||
return false;
|
||||
auto const& includePaths = this->MocConst().IncludePaths;
|
||||
return std::any_of(
|
||||
includePaths.begin(), includePaths.end(),
|
||||
[&findHeader, &includeBase](std::string const& path) -> bool {
|
||||
return findHeader(cmStrCat(path, '/', includeBase));
|
||||
});
|
||||
}
|
||||
|
||||
bool cmQtAutoMocUicT::JobEvalCacheMocT::RegisterIncluded(
|
||||
@@ -1544,31 +1537,30 @@ bool cmQtAutoMocUicT::JobEvalCacheUicT::EvalFile(
|
||||
}
|
||||
|
||||
std::string const sourceDirPrefix = SubDirPrefix(sourceFile.FileName);
|
||||
for (IncludeKeyT const& incKey : Include) {
|
||||
// Find .ui file
|
||||
this->UiName = cmStrCat(incKey.Base, ".ui");
|
||||
if (!this->FindIncludedUi(sourceDirPrefix, incKey.Dir)) {
|
||||
this->LogError(
|
||||
GenT::UIC,
|
||||
cmStrCat(this->MessagePath(sourceFile.FileName),
|
||||
"\nincludes the uic file ", this->MessagePath(incKey.Key),
|
||||
",\nbut the user interface file ",
|
||||
this->MessagePath(this->UiName),
|
||||
"\ncould not be found in the following directories\n",
|
||||
this->MessageSearchLocations()));
|
||||
return false;
|
||||
}
|
||||
// Check if the file is skipped
|
||||
if (this->UicConst().skipped(this->UiFileHandle->FileName)) {
|
||||
continue;
|
||||
}
|
||||
// Register mapping
|
||||
if (!this->RegisterMapping(incKey.Key, sourceFileHandle)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return std::all_of(
|
||||
Include.begin(), Include.end(),
|
||||
[this, &sourceDirPrefix, &sourceFile,
|
||||
&sourceFileHandle](IncludeKeyT const& incKey) -> bool {
|
||||
// Find .ui file
|
||||
this->UiName = cmStrCat(incKey.Base, ".ui");
|
||||
if (!this->FindIncludedUi(sourceDirPrefix, incKey.Dir)) {
|
||||
this->LogError(
|
||||
GenT::UIC,
|
||||
cmStrCat(this->MessagePath(sourceFile.FileName),
|
||||
"\nincludes the uic file ", this->MessagePath(incKey.Key),
|
||||
",\nbut the user interface file ",
|
||||
this->MessagePath(this->UiName),
|
||||
"\ncould not be found in the following directories\n",
|
||||
this->MessageSearchLocations()));
|
||||
return false;
|
||||
}
|
||||
// Check if the file is skipped
|
||||
if (this->UicConst().skipped(this->UiFileHandle->FileName)) {
|
||||
return true;
|
||||
}
|
||||
// Register mapping
|
||||
return this->RegisterMapping(incKey.Key, sourceFileHandle);
|
||||
});
|
||||
}
|
||||
|
||||
bool cmQtAutoMocUicT::JobEvalCacheUicT::FindIncludedUi(
|
||||
@@ -2708,7 +2700,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);
|
||||
|
||||
@@ -52,7 +52,6 @@ private:
|
||||
bool GenerateRcc();
|
||||
bool GenerateWrapper();
|
||||
|
||||
private:
|
||||
// -- Config settings
|
||||
bool MultiConfig_ = false;
|
||||
// -- Directories
|
||||
|
||||
@@ -181,13 +181,10 @@ bool cmRuntimeDependencyArchive::GetRuntimeDependencies(
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (auto const& mod : modules) {
|
||||
if (!this->Linker->ScanDependencies(mod, cmStateEnums::MODULE_LIBRARY)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return std::all_of(
|
||||
modules.begin(), modules.end(), [this](std::string const& mod) -> bool {
|
||||
return this->Linker->ScanDependencies(mod, cmStateEnums::MODULE_LIBRARY);
|
||||
});
|
||||
}
|
||||
|
||||
void cmRuntimeDependencyArchive::SetError(const std::string& e)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmScriptGenerator.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "cmStringAlgorithms.h"
|
||||
@@ -11,7 +12,6 @@ cmScriptGenerator::cmScriptGenerator(std::string config_var,
|
||||
std::vector<std::string> configurations)
|
||||
: RuntimeConfigVariable(std::move(config_var))
|
||||
, Configurations(std::move(configurations))
|
||||
, ConfigurationName("")
|
||||
, ConfigurationTypes(nullptr)
|
||||
, ActionsPerConfig(false)
|
||||
{
|
||||
@@ -120,12 +120,10 @@ bool cmScriptGenerator::GeneratesForConfig(const std::string& config)
|
||||
// This is a configuration-specific rule. Check if the config
|
||||
// matches this rule.
|
||||
std::string config_upper = cmSystemTools::UpperCase(config);
|
||||
for (std::string const& cfg : this->Configurations) {
|
||||
if (cmSystemTools::UpperCase(cfg) == config_upper) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(this->Configurations.begin(), this->Configurations.end(),
|
||||
[&config_upper](std::string const& cfg) -> bool {
|
||||
return cmSystemTools::UpperCase(cfg) == config_upper;
|
||||
});
|
||||
}
|
||||
|
||||
void cmScriptGenerator::GenerateScriptActionsOnce(std::ostream& os,
|
||||
|
||||
@@ -189,7 +189,7 @@ std::string MakeSourceFilePathAbsoluteIfNeeded(
|
||||
if (!needed) {
|
||||
return source_file_path;
|
||||
}
|
||||
const std::string absolute_file_path = cmSystemTools::CollapseFullPath(
|
||||
std::string absolute_file_path = cmSystemTools::CollapseFullPath(
|
||||
source_file_path, status.GetMakefile().GetCurrentSourceDirectory());
|
||||
return absolute_file_path;
|
||||
}
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,18 +4,22 @@
|
||||
|
||||
#if defined(__linux)
|
||||
/* Needed for glibc < 2.12 */
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier)
|
||||
# define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
#if !defined(_WIN32) && !defined(__sun)
|
||||
/* POSIX APIs are needed */
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier)
|
||||
# define _POSIX_C_SOURCE 200809L
|
||||
#endif
|
||||
#if defined(__sun) && defined(__GNUC__) && !defined(__cplusplus)
|
||||
/* C sources: for fileno and strdup */
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier)
|
||||
# define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
/* For isascii */
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier)
|
||||
# define _XOPEN_SOURCE 700
|
||||
#endif
|
||||
|
||||
|
||||
+4
-7
@@ -110,12 +110,9 @@ bool cmState::StringToCacheEntryType(const std::string& s,
|
||||
|
||||
bool cmState::IsCacheEntryType(std::string const& key)
|
||||
{
|
||||
for (const std::string& i : cmCacheEntryTypes) {
|
||||
if (key == i) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(
|
||||
cmCacheEntryTypes.begin(), cmCacheEntryTypes.end(),
|
||||
[&key](std::string const& i) -> bool { return key == i; });
|
||||
}
|
||||
|
||||
bool cmState::LoadCache(const std::string& path, bool internal,
|
||||
@@ -347,7 +344,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;
|
||||
|
||||
@@ -97,7 +97,6 @@ private:
|
||||
void ComputeRelativePathTopSource();
|
||||
void ComputeRelativePathTopBinary();
|
||||
|
||||
private:
|
||||
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator
|
||||
DirectoryState;
|
||||
cmStateSnapshot Snapshot_;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
// NOLINTNEXTLINE(bugprone-reserved-identifier)
|
||||
#define _SCL_SECURE_NO_WARNINGS
|
||||
|
||||
#include "cmString.hxx"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user