Author: Joel E. Denny
Date: 2024-09-04T18:43:54-04:00
New Revision: 7c4eb60c9509c3a750961eac2dbcaad369d911f2

URL: 
https://github.com/llvm/llvm-project/commit/7c4eb60c9509c3a750961eac2dbcaad369d911f2
DIFF: 
https://github.com/llvm/llvm-project/commit/7c4eb60c9509c3a750961eac2dbcaad369d911f2.diff

LOG: [Clang] Fix CLANG_TOOLCHAIN_PROGRAM_TIMEOUT logic

PR #102521, which landed as 1ea0865dd6fa, 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.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChain.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 64f23d43e87ee8..16f9b629fc538c 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -126,7 +126,7 @@ ToolChain::executeToolChainProgram(StringRef Executable) 
const {
                                      "CLANG_TOOLCHAIN_PROGRAM_TIMEOUT expected 
"
                                      "an integer, got '" +
                                          *Str + "'");
-    SecondsToWait = std::min(SecondsToWait, 0); // infinite
+    SecondsToWait = std::max(SecondsToWait, 0); // infinite
   }
   if (llvm::sys::ExecuteAndWait(Executable, {}, {}, Redirects, SecondsToWait,
                                 /*MemoryLimit=*/0, &ErrorMessage))


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to