mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-30 18:29:37 -06:00
clang-tidy: fix readability-else-after-return lints
This commit is contained in:
@@ -1503,19 +1503,23 @@ std::string cmGlobalVisualStudio10Generator::GetClFlagTableName() const
|
||||
|
||||
if (toolset == "v142") {
|
||||
return "v142";
|
||||
} else if (toolset == "v141") {
|
||||
return "v141";
|
||||
} else if (useToolset == "v140") {
|
||||
return "v140";
|
||||
} else if (useToolset == "v120") {
|
||||
return "v12";
|
||||
} else if (useToolset == "v110") {
|
||||
return "v11";
|
||||
} else if (useToolset == "v100") {
|
||||
return "v10";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
if (toolset == "v141") {
|
||||
return "v141";
|
||||
}
|
||||
if (useToolset == "v140") {
|
||||
return "v140";
|
||||
}
|
||||
if (useToolset == "v120") {
|
||||
return "v12";
|
||||
}
|
||||
if (useToolset == "v110") {
|
||||
return "v11";
|
||||
}
|
||||
if (useToolset == "v100") {
|
||||
return "v10";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string cmGlobalVisualStudio10Generator::GetCSharpFlagTableName() const
|
||||
@@ -1525,19 +1529,23 @@ std::string cmGlobalVisualStudio10Generator::GetCSharpFlagTableName() const
|
||||
|
||||
if (useToolset == "v142") {
|
||||
return "v142";
|
||||
} else if (useToolset == "v141") {
|
||||
return "v141";
|
||||
} else if (useToolset == "v140") {
|
||||
return "v140";
|
||||
} else if (useToolset == "v120") {
|
||||
return "v12";
|
||||
} else if (useToolset == "v110") {
|
||||
return "v11";
|
||||
} else if (useToolset == "v100") {
|
||||
return "v10";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
if (useToolset == "v141") {
|
||||
return "v141";
|
||||
}
|
||||
if (useToolset == "v140") {
|
||||
return "v140";
|
||||
}
|
||||
if (useToolset == "v120") {
|
||||
return "v12";
|
||||
}
|
||||
if (useToolset == "v110") {
|
||||
return "v11";
|
||||
}
|
||||
if (useToolset == "v100") {
|
||||
return "v10";
|
||||
}
|
||||
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") {
|
||||
return "v12";
|
||||
} else if (useToolset == "v110") {
|
||||
return "v11";
|
||||
} else if (useToolset == "v100") {
|
||||
return "v10";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
if (useToolset == "v120") {
|
||||
return "v12";
|
||||
}
|
||||
if (useToolset == "v110") {
|
||||
return "v11";
|
||||
}
|
||||
if (useToolset == "v100") {
|
||||
return "v10";
|
||||
}
|
||||
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") {
|
||||
return "v12";
|
||||
} else if (useToolset == "v110") {
|
||||
return "v11";
|
||||
} else if (useToolset == "v100") {
|
||||
return "v10";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
if (useToolset == "v120") {
|
||||
return "v12";
|
||||
}
|
||||
if (useToolset == "v110") {
|
||||
return "v11";
|
||||
}
|
||||
if (useToolset == "v100") {
|
||||
return "v10";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string cmGlobalVisualStudio10Generator::GetLinkFlagTableName() const
|
||||
@@ -1585,19 +1597,23 @@ std::string cmGlobalVisualStudio10Generator::GetLinkFlagTableName() const
|
||||
|
||||
if (useToolset == "v142") {
|
||||
return "v142";
|
||||
} else if (useToolset == "v141") {
|
||||
return "v141";
|
||||
} else if (useToolset == "v140") {
|
||||
return "v140";
|
||||
} else if (useToolset == "v120") {
|
||||
return "v12";
|
||||
} else if (useToolset == "v110") {
|
||||
return "v11";
|
||||
} else if (useToolset == "v100") {
|
||||
return "v10";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
if (useToolset == "v141") {
|
||||
return "v141";
|
||||
}
|
||||
if (useToolset == "v140") {
|
||||
return "v140";
|
||||
}
|
||||
if (useToolset == "v120") {
|
||||
return "v12";
|
||||
}
|
||||
if (useToolset == "v110") {
|
||||
return "v11";
|
||||
}
|
||||
if (useToolset == "v100") {
|
||||
return "v10";
|
||||
}
|
||||
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") {
|
||||
return "v12";
|
||||
} else if (useToolset == "v110") {
|
||||
return "v11";
|
||||
} else if (useToolset == "v100") {
|
||||
return "v10";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
if (useToolset == "v120") {
|
||||
return "v12";
|
||||
}
|
||||
if (useToolset == "v110") {
|
||||
return "v11";
|
||||
}
|
||||
if (useToolset == "v100") {
|
||||
return "v10";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string cmGlobalVisualStudio10Generator::CanonicalToolsetName(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -85,19 +85,19 @@ static std::string VSHostPlatformName()
|
||||
{
|
||||
if (VSIsArm64Host()) {
|
||||
return "ARM64";
|
||||
} else if (VSIsWow64()) {
|
||||
return "x64";
|
||||
} else {
|
||||
#if defined(_M_ARM)
|
||||
return "ARM";
|
||||
#elif defined(_M_IA64)
|
||||
return "Itanium";
|
||||
#elif defined(_WIN64)
|
||||
return "x64";
|
||||
#else
|
||||
return "Win32";
|
||||
#endif
|
||||
}
|
||||
if (VSIsWow64()) {
|
||||
return "x64";
|
||||
}
|
||||
#if defined(_M_ARM)
|
||||
return "ARM";
|
||||
#elif defined(_M_IA64)
|
||||
return "Itanium";
|
||||
#elif defined(_WIN64)
|
||||
return "x64";
|
||||
#else
|
||||
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()) {
|
||||
return "x64";
|
||||
} else {
|
||||
#if defined(_M_ARM)
|
||||
return "";
|
||||
#elif defined(_M_IA64)
|
||||
return "";
|
||||
#elif defined(_WIN64)
|
||||
return "x64";
|
||||
#else
|
||||
return "x86";
|
||||
#endif
|
||||
}
|
||||
if (VSIsWow64()) {
|
||||
return "x64";
|
||||
}
|
||||
#if defined(_M_ARM)
|
||||
return "";
|
||||
#elif defined(_M_IA64)
|
||||
return "";
|
||||
#elif defined(_WIN64)
|
||||
return "x64";
|
||||
#else
|
||||
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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user