[llvm] 61c1f6d - [cmake] Warn if LLVM_PROFDATA_FILE was specified but wasn't found (#139882)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 12:05:02 PDT 2025


Author: Martin Storsjö
Date: 2025-05-14T22:04:58+03:00
New Revision: 61c1f6d7e84f1213bd727437a7ec5b7fc5eaf121

URL: https://github.com/llvm/llvm-project/commit/61c1f6d7e84f1213bd727437a7ec5b7fc5eaf121
DIFF: https://github.com/llvm/llvm-project/commit/61c1f6d7e84f1213bd727437a7ec5b7fc5eaf121.diff

LOG: [cmake] Warn if LLVM_PROFDATA_FILE was specified but wasn't found (#139882)

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.

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
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)


        


More information about the llvm-commits mailing list