mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-01 20:28:37 -06:00
Merge topic 'clang-tidy'
0cd654c8cmGeneratorTarget: Correctly set FortranModuleDirectoryCreatedbac93dcfcmGeneratorTarget: Don't assing a bool to a string1e994985cmGlobalNinjaGenerator: Suppress clang-tidy warning5ae3966dcmCTestSubmitHandler: Remove redundant c_str()443180fbcmCPluginAPI: Fix clang-tidy findings
This commit is contained in:
@@ -926,7 +926,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(
|
||||
return false;
|
||||
}
|
||||
size_t fileSize = static_cast<size_t>(st.st_size);
|
||||
FILE* fp = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
|
||||
FILE* fp = cmsys::SystemTools::Fopen(local_file, "rb");
|
||||
if (!fp) {
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||
" Cannot open file: " << local_file << std::endl);
|
||||
|
||||
@@ -408,7 +408,7 @@ char CCONV* cmExpandVariablesInString(void* arg, const char* source,
|
||||
std::string result = mf->ExpandVariablesInString(
|
||||
barf, (escapeQuotes ? true : false), (atOnly ? true : false));
|
||||
char* res = static_cast<char*>(malloc(result.size() + 1));
|
||||
if (result.size()) {
|
||||
if (!result.empty()) {
|
||||
strcpy(res, result.c_str());
|
||||
}
|
||||
res[result.size()] = '\0';
|
||||
@@ -570,7 +570,7 @@ void* CCONV cmAddSource(void* arg, void* arg2)
|
||||
rsf->GetProperties() = osf->Properties;
|
||||
for (std::vector<std::string>::iterator i = osf->Depends.begin();
|
||||
i != osf->Depends.end(); ++i) {
|
||||
rsf->AddDepend(i->c_str());
|
||||
rsf->AddDepend(*i);
|
||||
}
|
||||
|
||||
// Create the proxy for the real source file.
|
||||
@@ -676,7 +676,7 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir,
|
||||
std::string hname = pathname;
|
||||
if (cmSystemTools::FileExists(hname.c_str())) {
|
||||
sf->SourceName = cmSystemTools::GetFilenamePath(name);
|
||||
if (sf->SourceName.size() > 0) {
|
||||
if (!sf->SourceName.empty()) {
|
||||
sf->SourceName += "/";
|
||||
}
|
||||
sf->SourceName += cmSystemTools::GetFilenameWithoutLastExtension(name);
|
||||
@@ -756,7 +756,7 @@ void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir,
|
||||
fname += ".";
|
||||
fname += ext;
|
||||
}
|
||||
sf->FullPath = cmSystemTools::CollapseFullPath(fname.c_str(), dir);
|
||||
sf->FullPath = cmSystemTools::CollapseFullPath(fname, dir);
|
||||
cmSystemTools::ConvertToUnixSlashes(sf->FullPath);
|
||||
sf->SourceExtension = ext;
|
||||
}
|
||||
|
||||
@@ -3945,9 +3945,9 @@ std::string cmGeneratorTarget::GetFortranModuleDirectory(
|
||||
std::string const& working_dir) const
|
||||
{
|
||||
if (!this->FortranModuleDirectoryCreated) {
|
||||
this->FortranModuleDirectory = true;
|
||||
this->FortranModuleDirectory =
|
||||
this->CreateFortranModuleDirectory(working_dir);
|
||||
this->FortranModuleDirectoryCreated = true;
|
||||
}
|
||||
|
||||
return this->FortranModuleDirectory;
|
||||
|
||||
@@ -130,7 +130,7 @@ std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string& lit)
|
||||
|
||||
std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path)
|
||||
{
|
||||
std::string result = path;
|
||||
std::string result = path; // NOLINT(clang-tidy)
|
||||
#ifdef _WIN32
|
||||
if (this->IsGCCOnWindows())
|
||||
std::replace(result.begin(), result.end(), '\\', '/');
|
||||
@@ -283,7 +283,7 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
|
||||
bool restat, const cmNinjaDeps& outputs, const cmNinjaDeps& deps,
|
||||
const cmNinjaDeps& orderOnly)
|
||||
{
|
||||
std::string cmd = command;
|
||||
std::string cmd = command; // NOLINT(clang-tidy)
|
||||
#ifdef _WIN32
|
||||
if (cmd.empty())
|
||||
// TODO Shouldn't an empty command be handled by ninja?
|
||||
|
||||
Reference in New Issue
Block a user