Author: Utkarsh Saxena Date: 2025-11-04T12:53:58-05:00 New Revision: 1409db663139a644871362ffb23d725078bc84cf
URL: https://github.com/llvm/llvm-project/commit/1409db663139a644871362ffb23d725078bc84cf DIFF: https://github.com/llvm/llvm-project/commit/1409db663139a644871362ffb23d725078bc84cf.diff LOG: [LifetimeSafety] Fix Python path for Windows compatibility (#166291) Fix Python virtual environment paths for Windows in the Lifetime Safety Analysis benchmark ### What changed? - Added conditional path setting for the Python executable in the virtual environment based on the platform - For Windows, use `Scripts/python` path - For other platforms, use `bin/python` path - Updated the commands that use the Python virtual environment to use the platform-specific path ### How to test? `ninja benchmark_lifetime_safety_analysis` Fixes #166143 Added: Modified: clang/test/Analysis/LifetimeSafety/CMakeLists.txt Removed: ################################################################################ diff --git a/clang/test/Analysis/LifetimeSafety/CMakeLists.txt b/clang/test/Analysis/LifetimeSafety/CMakeLists.txt index ce37a29655668..2f9c2ac247497 100644 --- a/clang/test/Analysis/LifetimeSafety/CMakeLists.txt +++ b/clang/test/Analysis/LifetimeSafety/CMakeLists.txt @@ -15,6 +15,13 @@ set(LIFETIME_BENCHMARK_REQUIREMENTS set(LIFETIME_BENCHMARK_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/benchmark_results") +if(WIN32) + set(LIFETIME_BENCHMARK_VENV_PYTHON_EXECUTABLE + "${LIFETIME_BENCHMARK_VENV_DIR}/Scripts/python") +else() + set(LIFETIME_BENCHMARK_VENV_PYTHON_EXECUTABLE + "${LIFETIME_BENCHMARK_VENV_DIR}/bin/python") +endif() if(EXISTS ${LIFETIME_BENCHMARK_SCRIPT} AND EXISTS ${LIFETIME_BENCHMARK_REQUIREMENTS}) @@ -22,7 +29,7 @@ if(EXISTS ${LIFETIME_BENCHMARK_SCRIPT} AND EXISTS ${LIFETIME_BENCHMARK_REQUIREME add_custom_command( OUTPUT ${LIFETIME_BENCHMARK_VENV_DIR}/pyvenv.cfg COMMAND ${Python3_EXECUTABLE} -m venv ${LIFETIME_BENCHMARK_VENV_DIR} - COMMAND ${LIFETIME_BENCHMARK_VENV_DIR}/bin/python -m pip install -r ${LIFETIME_BENCHMARK_REQUIREMENTS} + COMMAND ${LIFETIME_BENCHMARK_VENV_PYTHON_EXECUTABLE} -m pip install -r ${LIFETIME_BENCHMARK_REQUIREMENTS} DEPENDS ${LIFETIME_BENCHMARK_REQUIREMENTS} COMMENT "Creating Python virtual environment and installing dependencies for benchmark..." ) @@ -32,7 +39,7 @@ if(EXISTS ${LIFETIME_BENCHMARK_SCRIPT} AND EXISTS ${LIFETIME_BENCHMARK_REQUIREME # Main benchmark target add_custom_target(benchmark_lifetime_safety_analysis - COMMAND ${LIFETIME_BENCHMARK_VENV_DIR}/bin/python ${LIFETIME_BENCHMARK_SCRIPT} + COMMAND ${LIFETIME_BENCHMARK_VENV_PYTHON_EXECUTABLE} ${LIFETIME_BENCHMARK_SCRIPT} --clang-binary ${LLVM_BINARY_DIR}/bin/clang --output-dir ${LIFETIME_BENCHMARK_OUTPUT_DIR} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
