From 09399692ebacb9a0017347bb5b234bf9bdbb86b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 14 May 2025 07:09:04 +0300 Subject: [PATCH] [cmake] Warn if LLVM_PROFDATA_FILE was specified but wasn't found Ideally we should perhaps even error out here; if the user requested building with profiling info, but that profile wasn't found, it seems like the build configuration is subtly broken, and I would expect the user to want to know about it. But that may be a too disruptive change, as users may very well rely on being able to build things in such a setup anyway thanks to Hyrum's Law. To make things clearer, at least print a warning in this case. --- llvm/cmake/modules/HandleLLVMOptions.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index c427a65ee030c..2912f45953c41 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -1240,6 +1240,8 @@ if(LLVM_PROFDATA_FILE AND EXISTS ${LLVM_PROFDATA_FILE}) else() message(FATAL_ERROR "LLVM_PROFDATA_FILE can only be specified when compiling with clang") endif() +elseif(LLVM_PROFDATA_FILE) + message(WARNING "LLVM_PROFDATA_FILE specified, but ${LLVM_PROFDATA_FILE} not found") endif() option(LLVM_BUILD_INSTRUMENTED_COVERAGE "Build LLVM and tools with Code Coverage instrumentation" Off)