Skip to content

Commit 2bc1e13

Browse files
fpelliccionialandefreitas
authored andcommitted
code simplification
1 parent 062b399 commit 2bc1e13

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/lib/Lib/CMakeExecution.cpp

+13-12
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,24 @@ Expected<std::string>
158158
getCmakeDefaultGenerator(llvm::StringRef cmakePath)
159159
{
160160
Expected<std::string> const cmakeHelpExp = executeCmakeHelp(cmakePath);
161-
if (!cmakeHelpExp)
161+
if (cmakeHelpExp)
162+
{
163+
std::string const cmakeHelp = *std::move(cmakeHelpExp);
164+
return parseCmakeHelpOutput(cmakeHelp);
165+
}
166+
167+
Expected<std::string> const cmakeSystemInformationExp = executeCmakeSystemInformation(cmakePath);
168+
if (cmakeSystemInformationExp)
162169
{
163-
Expected<std::string> const cmakeSystemInformationExp = executeCmakeSystemInformation(cmakePath);
164-
if (!cmakeSystemInformationExp)
165-
{
166-
if (llvm::sys::path::extension(cmakePath) == ".exe")
167-
{
168-
return "Visual Studio 17 2022";
169-
}
170-
return "Unix Makefiles";
171-
}
172170
std::string const cmakeSystemInformation = *std::move(cmakeSystemInformationExp);
173171
return parseCmakeSystemInformationOutput(cmakeSystemInformation);
174172
}
175173

176-
std::string const cmakeHelp = *std::move(cmakeHelpExp);
177-
return parseCmakeHelpOutput(cmakeHelp);
174+
if (llvm::sys::path::extension(cmakePath) == ".exe")
175+
{
176+
return "Visual Studio 17 2022";
177+
}
178+
return "Unix Makefiles";
178179
}
179180

180181
Expected<bool>

0 commit comments

Comments
 (0)