summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2022-11-22 18:58:40 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2022-11-29 17:39:29 (GMT)
commitb72c45e39fa9dd5870046bb5cf25d33049006bd5 (patch)
tree5bbeafd0dc942663e48b999e6d41d0446e1d2b1d
parent07172aa31ec468baea0dc3e52ce6f706f55d6f12 (diff)
downloadCMake-b72c45e39fa9dd5870046bb5cf25d33049006bd5.zip
CMake-b72c45e39fa9dd5870046bb5cf25d33049006bd5.tar.gz
CMake-b72c45e39fa9dd5870046bb5cf25d33049006bd5.tar.bz2
clang-tidy: fix `readability-else-after-return` lints
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx90
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx18
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx11
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx31
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmVSSetupHelper.cxx12
-rw-r--r--Source/cmVSSetupHelper.h3
-rw-r--r--Source/cmVisualStudioSlnData.cxx6
-rw-r--r--Source/cmVisualStudioSlnParser.cxx13
12 files changed, 107 insertions, 99 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index ecf6539..1582207 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1503,19 +1503,23 @@ std::string cmGlobalVisualStudio10Generator::GetClFlagTableName() const
if (toolset == "v142") {
return "v142";
- } else if (toolset == "v141") {
+ }
+ if (toolset == "v141") {
return "v141";
- } else if (useToolset == "v140") {
+ }
+ if (useToolset == "v140") {
return "v140";
- } else if (useToolset == "v120") {
+ }
+ if (useToolset == "v120") {
return "v12";
- } else if (useToolset == "v110") {
+ }
+ if (useToolset == "v110") {
return "v11";
- } else if (useToolset == "v100") {
+ }
+ if (useToolset == "v100") {
return "v10";
- } else {
- return "";
}
+ return "";
}
std::string cmGlobalVisualStudio10Generator::GetCSharpFlagTableName() const
@@ -1525,19 +1529,23 @@ std::string cmGlobalVisualStudio10Generator::GetCSharpFlagTableName() const
if (useToolset == "v142") {
return "v142";
- } else if (useToolset == "v141") {
+ }
+ if (useToolset == "v141") {
return "v141";
- } else if (useToolset == "v140") {
+ }
+ if (useToolset == "v140") {
return "v140";
- } else if (useToolset == "v120") {
+ }
+ if (useToolset == "v120") {
return "v12";
- } else if (useToolset == "v110") {
+ }
+ if (useToolset == "v110") {
return "v11";
- } else if (useToolset == "v100") {
+ }
+ if (useToolset == "v100") {
return "v10";
- } else {
- return "";
}
+ return "";
}
std::string cmGlobalVisualStudio10Generator::GetRcFlagTableName() const
@@ -1548,15 +1556,17 @@ std::string cmGlobalVisualStudio10Generator::GetRcFlagTableName() const
if ((useToolset == "v140") || (useToolset == "v141") ||
(useToolset == "v142")) {
return "v14";
- } else if (useToolset == "v120") {
+ }
+ if (useToolset == "v120") {
return "v12";
- } else if (useToolset == "v110") {
+ }
+ if (useToolset == "v110") {
return "v11";
- } else if (useToolset == "v100") {
+ }
+ if (useToolset == "v100") {
return "v10";
- } else {
- return "";
}
+ return "";
}
std::string cmGlobalVisualStudio10Generator::GetLibFlagTableName() const
@@ -1567,15 +1577,17 @@ std::string cmGlobalVisualStudio10Generator::GetLibFlagTableName() const
if ((useToolset == "v140") || (useToolset == "v141") ||
(useToolset == "v142")) {
return "v14";
- } else if (useToolset == "v120") {
+ }
+ if (useToolset == "v120") {
return "v12";
- } else if (useToolset == "v110") {
+ }
+ if (useToolset == "v110") {
return "v11";
- } else if (useToolset == "v100") {
+ }
+ if (useToolset == "v100") {
return "v10";
- } else {
- return "";
}
+ return "";
}
std::string cmGlobalVisualStudio10Generator::GetLinkFlagTableName() const
@@ -1585,19 +1597,23 @@ std::string cmGlobalVisualStudio10Generator::GetLinkFlagTableName() const
if (useToolset == "v142") {
return "v142";
- } else if (useToolset == "v141") {
+ }
+ if (useToolset == "v141") {
return "v141";
- } else if (useToolset == "v140") {
+ }
+ if (useToolset == "v140") {
return "v140";
- } else if (useToolset == "v120") {
+ }
+ if (useToolset == "v120") {
return "v12";
- } else if (useToolset == "v110") {
+ }
+ if (useToolset == "v110") {
return "v11";
- } else if (useToolset == "v100") {
+ }
+ if (useToolset == "v100") {
return "v10";
- } else {
- return "";
}
+ return "";
}
std::string cmGlobalVisualStudio10Generator::GetMasmFlagTableName() const
@@ -1608,15 +1624,17 @@ std::string cmGlobalVisualStudio10Generator::GetMasmFlagTableName() const
if ((useToolset == "v140") || (useToolset == "v141") ||
(useToolset == "v142")) {
return "v14";
- } else if (useToolset == "v120") {
+ }
+ if (useToolset == "v120") {
return "v12";
- } else if (useToolset == "v110") {
+ }
+ if (useToolset == "v110") {
return "v11";
- } else if (useToolset == "v100") {
+ }
+ if (useToolset == "v100") {
return "v10";
- } else {
- return "";
}
+ return "";
}
std::string cmGlobalVisualStudio10Generator::CanonicalToolsetName(
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index c5b4340..1155dfc 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -216,9 +216,8 @@ bool cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(
this->IsWindowsDesktopToolsetInstalled()) {
toolset = "v110_wp80";
return true;
- } else {
- return false;
}
+ return false;
}
return this->cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(
toolset);
@@ -232,9 +231,8 @@ bool cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(
this->IsWindowsDesktopToolsetInstalled()) {
toolset = "v110";
return true;
- } else {
- return false;
}
+ return false;
}
return this->cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(
toolset);
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index dbe3519..d417f9e 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -194,9 +194,8 @@ bool cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset(
this->IsWindowsDesktopToolsetInstalled()) {
toolset = "v120_wp81";
return true;
- } else {
- return false;
}
+ return false;
}
return this->cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(
toolset);
@@ -210,9 +209,8 @@ bool cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset(
this->IsWindowsDesktopToolsetInstalled()) {
toolset = "v120";
return true;
- } else {
- return false;
}
+ return false;
}
return this->cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(
toolset);
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 5ed2c94..a26e60a 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -213,9 +213,8 @@ bool cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset(
this->IsWindowsDesktopToolsetInstalled()) {
toolset = "v140";
return true;
- } else {
- return false;
}
+ return false;
}
return this->cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset(
toolset);
@@ -255,7 +254,7 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersion(
return std::string();
}
// If the value is something else, trust that it is a valid SDK value.
- else if (value) {
+ if (value) {
return *value;
}
// If value is an invalid pointer, leave result unchanged.
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index f9bf044..d7bf106 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -190,17 +190,23 @@ const char* cmGlobalVisualStudio7Generator::ExternalProjectType(
std::string extension = cmSystemTools::GetFilenameLastExtension(location);
if (extension == ".vbproj") {
return "F184B08F-C81C-45F6-A57F-5ABD9991F28F";
- } else if (extension == ".csproj") {
+ }
+ if (extension == ".csproj") {
return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC";
- } else if (extension == ".fsproj") {
+ }
+ if (extension == ".fsproj") {
return "F2A71F9B-5D33-465A-A702-920D77279786";
- } else if (extension == ".vdproj") {
+ }
+ if (extension == ".vdproj") {
return "54435603-DBB4-11D2-8724-00A0C9A8B90C";
- } else if (extension == ".dbproj") {
+ }
+ if (extension == ".dbproj") {
return "C8D11400-126E-41CD-887F-60BD40844F9E";
- } else if (extension == ".wixproj") {
+ }
+ if (extension == ".wixproj") {
return "930C7802-8A8C-48F9-8165-68863BCCD9DD";
- } else if (extension == ".pyproj") {
+ }
+ if (extension == ".pyproj") {
return "888888A0-9F3D-457C-B088-3A5042F75D52";
}
return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942";
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 34bc963..2987360 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -518,13 +518,12 @@ std::string cmGlobalVisualStudioGenerator::GetStartupProjectName(
std::string startup = *n;
if (this->FindTarget(startup)) {
return startup;
- } else {
- root->GetMakefile()->IssueMessage(
- MessageType::AUTHOR_WARNING,
- "Directory property VS_STARTUP_PROJECT specifies target "
- "'" +
- startup + "' that does not exist. Ignoring.");
}
+ root->GetMakefile()->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ "Directory property VS_STARTUP_PROJECT specifies target "
+ "'" +
+ startup + "' that does not exist. Ignoring.");
}
// default, if not specified
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 273bb8b..256ca1e 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -85,19 +85,19 @@ static std::string VSHostPlatformName()
{
if (VSIsArm64Host()) {
return "ARM64";
- } else if (VSIsWow64()) {
+ }
+ if (VSIsWow64()) {
return "x64";
- } else {
+ }
#if defined(_M_ARM)
- return "ARM";
+ return "ARM";
#elif defined(_M_IA64)
- return "Itanium";
+ return "Itanium";
#elif defined(_WIN64)
- return "x64";
+ return "x64";
#else
- return "Win32";
+ return "Win32";
#endif
- }
}
static std::string VSHostArchitecture(
@@ -105,19 +105,19 @@ static std::string VSHostArchitecture(
{
if (VSIsArm64Host()) {
return v >= cmGlobalVisualStudioGenerator::VSVersion::VS17 ? "ARM64" : "";
- } else if (VSIsWow64()) {
+ }
+ if (VSIsWow64()) {
return "x64";
- } else {
+ }
#if defined(_M_ARM)
- return "";
+ return "";
#elif defined(_M_IA64)
- return "";
+ return "";
#elif defined(_WIN64)
- return "x64";
+ return "x64";
#else
- return "x86";
+ return "x86";
#endif
- }
}
static unsigned int VSVersionToMajor(
@@ -900,9 +900,8 @@ bool cmGlobalVisualStudioVersionedGenerator::SelectWindowsStoreToolset(
this->IsWindowsDesktopToolsetInstalled()) {
toolset = VSVersionToToolset(this->Version);
return true;
- } else {
- return false;
}
+ return false;
}
return this->cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset(
toolset);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 1cceefa..acff990 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -278,10 +278,9 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
// the generator validated all project-named sources.
file->ResolveFullPath();
return file;
- } else {
- cmSystemTools::Error("Error adding rule for " + makefileIn);
- return nullptr;
}
+ cmSystemTools::Error("Error adding rule for " + makefileIn);
+ return nullptr;
}
void cmLocalVisualStudio7Generator::WriteConfigurations(
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index a3f0faf..43c52bf 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -187,21 +187,19 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(
SmartBSTR bstrVersion;
if (FAILED(pInstance->GetInstallationVersion(&bstrVersion))) {
return false;
- } else {
- vsInstanceInfo.Version =
- cmsys::Encoding::ToNarrow(std::wstring(bstrVersion));
}
+ vsInstanceInfo.Version =
+ cmsys::Encoding::ToNarrow(std::wstring(bstrVersion));
// Reboot may have been required before the installation path was created.
SmartBSTR bstrInstallationPath;
if ((eLocal & state) == eLocal) {
if (FAILED(pInstance->GetInstallationPath(&bstrInstallationPath))) {
return false;
- } else {
- vsInstanceInfo.VSInstallLocation =
- cmsys::Encoding::ToNarrow(std::wstring(bstrInstallationPath));
- cmSystemTools::ConvertToUnixSlashes(vsInstanceInfo.VSInstallLocation);
}
+ vsInstanceInfo.VSInstallLocation =
+ cmsys::Encoding::ToNarrow(std::wstring(bstrInstallationPath));
+ cmSystemTools::ConvertToUnixSlashes(vsInstanceInfo.VSInstallLocation);
}
// Check if a compiler is installed with this instance.
diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h
index ea94d37..4ef7e15 100644
--- a/Source/cmVSSetupHelper.h
+++ b/Source/cmVSSetupHelper.h
@@ -47,9 +47,8 @@ public:
{
if (pp != nullptr) {
return ptr->QueryInterface(rclsid, (void**)pp);
- } else {
- return E_FAIL;
}
+ return E_FAIL;
}
HRESULT CoCreateInstance(REFCLSID clsid, IUnknown* pUnknown,
REFIID interfaceId, DWORD dwClsContext = CLSCTX_ALL)
diff --git a/Source/cmVisualStudioSlnData.cxx b/Source/cmVisualStudioSlnData.cxx
index da5a56c..98bbc34 100644
--- a/Source/cmVisualStudioSlnData.cxx
+++ b/Source/cmVisualStudioSlnData.cxx
@@ -26,8 +26,7 @@ const cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByGUID(
auto it(ProjectsByGUID.find(projectGUID));
if (it != ProjectsByGUID.end())
return it->second;
- else
- return cm::nullopt;
+ return cm::nullopt;
}
const cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByName(
@@ -36,8 +35,7 @@ const cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByName(
auto it(ProjectNameIndex.find(projectName));
if (it != ProjectNameIndex.end())
return it->second->second;
- else
- return cm::nullopt;
+ return cm::nullopt;
}
std::vector<cmSlnProjectEntry> cmSlnData::GetProjects() const
diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx
index 2b5cfd5..0c92a96 100644
--- a/Source/cmVisualStudioSlnParser.cxx
+++ b/Source/cmVisualStudioSlnParser.cxx
@@ -82,8 +82,7 @@ std::string cmVisualStudioSlnParser::ParsedLine::GetArgVerbatim() const
{
if (this->Arg.second)
return Quote + this->Arg.first + Quote;
- else
- return this->Arg.first;
+ return this->Arg.first;
}
const std::string& cmVisualStudioSlnParser::ParsedLine::GetValue(
@@ -91,8 +90,7 @@ const std::string& cmVisualStudioSlnParser::ParsedLine::GetValue(
{
if (idxValue < this->Values.size())
return this->Values[idxValue].first;
- else
- return BadString;
+ return BadString;
}
std::string cmVisualStudioSlnParser::ParsedLine::GetValueVerbatim(
@@ -102,10 +100,9 @@ std::string cmVisualStudioSlnParser::ParsedLine::GetValueVerbatim(
const StringData& data = this->Values[idxValue];
if (data.second)
return Quote + data.first + Quote;
- else
- return data.first;
- } else
- return BadString;
+ return data.first;
+ }
+ return BadString;
}
class cmVisualStudioSlnParser::State