summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-11-21 12:42:26 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-11-21 12:42:32 (GMT)
commit4e0c75b78f5745d1369867f25a46ab7d158b4469 (patch)
tree42de8e27d580c7338a405fec3402d6f6fe8e7f3f
parent2b427c2fadc917ebcaf2f246d53504ce5b6ad754 (diff)
parent5731ec30f0596fefede4321e9883043aa7db60ba (diff)
downloadCMake-4e0c75b78f5745d1369867f25a46ab7d158b4469.zip
CMake-4e0c75b78f5745d1369867f25a46ab7d158b4469.tar.gz
CMake-4e0c75b78f5745d1369867f25a46ab7d158b4469.tar.bz2
Merge topic 'clang-tidy'
5731ec30f0 clang-tidy: fix warnings from version 7 Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2636
-rw-r--r--.clang-tidy3
-rw-r--r--Source/QtDialog/AddCacheEntry.cxx4
-rw-r--r--Source/cmELF.cxx2
-rw-r--r--Source/cmExportFileGenerator.cxx2
-rw-r--r--Source/cmFileCommand.cxx2
-rw-r--r--Source/cmForEachCommand.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx3
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx6
-rw-r--r--Source/cmIfCommand.cxx2
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmWhileCommand.cxx2
-rw-r--r--Source/cmake.cxx2
12 files changed, 17 insertions, 15 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 8d79b0c..cec7d03 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -21,15 +21,18 @@ modernize-*,\
-modernize-use-using,\
performance-*,\
-performance-inefficient-string-concatenation,\
+-performance-inefficient-vector-operation,\
readability-*,\
-readability-function-size,\
-readability-identifier-naming,\
-readability-implicit-bool-cast,\
+-readability-implicit-bool-conversion,\
-readability-inconsistent-declaration-parameter-name,\
-readability-named-parameter,\
-readability-redundant-declaration,\
-readability-redundant-member-init,\
-readability-simplify-boolean-expr,\
+-readability-static-accessed-through-instance,\
"
HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$'
...
diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx
index 6284ac9..70610d7 100644
--- a/Source/QtDialog/AddCacheEntry.cxx
+++ b/Source/QtDialog/AddCacheEntry.cxx
@@ -21,8 +21,8 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames,
, VarTypes(varTypes)
{
this->setupUi(this);
- for (int i = 0; i < NumTypes; i++) {
- this->Type->addItem(TypeStrings[i]);
+ for (auto const& elem : TypeStrings) {
+ this->Type->addItem(elem);
}
QWidget* cb = new QCheckBox();
QWidget* path = new QCMakePathEditor();
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 0ccd68a..27f9131 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -684,7 +684,7 @@ cmELF::cmELF(const char* fname)
std::unique_ptr<cmsys::ifstream> fin(new cmsys::ifstream(fname));
// Quit now if the file could not be opened.
- if (!fin.get() || !*fin) {
+ if (!fin || !*fin) {
this->ErrorMessage = "Error opening input file.";
return;
}
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index bddc3c4..df27c62 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -79,7 +79,7 @@ bool cmExportFileGenerator::GenerateImportFile()
ap->SetCopyIfDifferent(true);
foutPtr = std::move(ap);
}
- if (!foutPtr.get() || !*foutPtr) {
+ if (!foutPtr || !*foutPtr) {
std::string se = cmSystemTools::GetLastSystemError();
std::ostringstream e;
e << "cannot write to file \"" << this->MainImportFile << "\": " << se;
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index f86e5e2..3012b0a 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2824,7 +2824,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
std::string algo = i->substr(0, pos);
expectedHash = cmSystemTools::LowerCase(i->substr(pos + 1));
hash = std::unique_ptr<cmCryptoHash>(cmCryptoHash::New(algo.c_str()));
- if (!hash.get()) {
+ if (!hash) {
std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: ";
err += algo;
this->SetError(err);
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 9ff967c..739c9c0 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -38,7 +38,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// Remove the function blocker for this scope or bail.
std::unique_ptr<cmFunctionBlocker> fb(
mf.RemoveFunctionBlocker(this, lff));
- if (!fb.get()) {
+ if (!fb) {
return false;
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 0b28d1e..80d81d5 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -4379,8 +4379,7 @@ const char* impliedValue<const char*>(const char* /*unused*/)
return "";
}
template <>
-std::string impliedValue<std::string>(
- std::string /*unused*/) // NOLINT(clang-tidy)
+std::string impliedValue<std::string>(std::string /*unused*/) // NOLINT(*)
{
return std::string();
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index fbc756c..0271b6f 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -112,7 +112,7 @@ std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string& lit)
std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path)
{
- std::string result = path; // NOLINT(clang-tidy)
+ std::string result = path;
#ifdef _WIN32
if (this->IsGCCOnWindows())
std::replace(result.begin(), result.end(), '\\', '/');
@@ -254,7 +254,7 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
bool restat, const cmNinjaDeps& outputs, const cmNinjaDeps& deps,
const cmNinjaDeps& orderOnly)
{
- std::string cmd = command; // NOLINT(clang-tidy)
+ std::string cmd = command; // NOLINT(*)
#ifdef _WIN32
if (cmd.empty())
// TODO Shouldn't an empty command be handled by ninja?
@@ -1940,7 +1940,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
cm.SetHomeOutputDirectory(dir_top_bld);
std::unique_ptr<cmGlobalNinjaGenerator> ggd(
static_cast<cmGlobalNinjaGenerator*>(cm.CreateGlobalGenerator("Ninja")));
- if (!ggd.get() ||
+ if (!ggd ||
!ggd->WriteDyndepFile(dir_top_src, dir_top_bld, dir_cur_src, dir_cur_bld,
arg_dd, arg_ddis, module_dir,
linked_target_dirs)) {
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index ae4041d..5d952da 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -39,7 +39,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// Remove the function blocker for this scope or bail.
std::unique_ptr<cmFunctionBlocker> fb(
mf.RemoveFunctionBlocker(this, lff));
- if (!fb.get()) {
+ if (!fb) {
return false;
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 790f6e0..5ad8ef6 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2342,7 +2342,7 @@ cmMakefile::AppleSDK cmMakefile::GetAppleSDKType() const
{ "watchsimulator", AppleSDK::WatchSimulator },
};
- for (auto entry : sdkDatabase) {
+ for (auto const& entry : sdkDatabase) {
if (sdkRoot.find(entry.name) == 0 ||
sdkRoot.find(std::string("/") + entry.name) != std::string::npos) {
return entry.sdk;
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index d5bcfc2..9d43d19 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -37,7 +37,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// Remove the function blocker for this scope or bail.
std::unique_ptr<cmFunctionBlocker> fb(
mf.RemoveFunctionBlocker(this, lff));
- if (!fb.get()) {
+ if (!fb) {
return false;
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 35730b8..2ac7f4d 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2596,7 +2596,7 @@ bool cmake::Open(const std::string& dir, bool dryRun)
std::unique_ptr<cmGlobalGenerator> gen(
this->CreateGlobalGenerator(fullName));
- if (!gen.get()) {
+ if (!gen) {
std::cerr << "Error: could create CMAKE_GENERATOR \"" << fullName
<< "\"\n";
return false;