Skip to content

Commit 7c4eb60

Browse files
committed
[Clang] Fix CLANG_TOOLCHAIN_PROGRAM_TIMEOUT logic
PR #102521, which landed as 1ea0865, implemented `CLANG_TOOLCHAIN_PROGRAM_TIMEOUT`, but the logic is obviously wrong. If the user-specified value is negative, it should become zero to mean infinite. Otherwise, it should be left as is. Thus, use `std::max` not `std::min`. This obvious fixup doesn't seem worth another pull request.
1 parent 9171881 commit 7c4eb60

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Driver/ToolChain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ ToolChain::executeToolChainProgram(StringRef Executable) const {
126126
"CLANG_TOOLCHAIN_PROGRAM_TIMEOUT expected "
127127
"an integer, got '" +
128128
*Str + "'");
129-
SecondsToWait = std::min(SecondsToWait, 0); // infinite
129+
SecondsToWait = std::max(SecondsToWait, 0); // infinite
130130
}
131131
if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects, SecondsToWait,
132132
/*MemoryLimit=*/0, &ErrorMessage))

0 commit comments

Comments
 (0)