Author: Yaxun (Sam) Liu Date: 2025-01-09T10:58:06-05:00 New Revision: 465a3ce9fac1fcf49d5772f70564973a73748d57
URL: https://github.com/llvm/llvm-project/commit/465a3ce9fac1fcf49d5772f70564973a73748d57 DIFF: https://github.com/llvm/llvm-project/commit/465a3ce9fac1fcf49d5772f70564973a73748d57.diff LOG: [CUDA][HIP] improve error message for missing cmath (#122155) One common error seen in CUDA/HIP compilation is: fatal error: 'cmath' file not found which is due to inproper installation of standard C++ libraries. Since it happens with #include_next, users may feel confusing which cmath is not found and how to fix it. Add an error directive to help users resolve this issue. Added: Modified: clang/lib/Headers/cuda_wrappers/cmath Removed: ################################################################################ diff --git a/clang/lib/Headers/cuda_wrappers/cmath b/clang/lib/Headers/cuda_wrappers/cmath index 45f89beec9b4df..7deca678bf252e 100644 --- a/clang/lib/Headers/cuda_wrappers/cmath +++ b/clang/lib/Headers/cuda_wrappers/cmath @@ -24,7 +24,11 @@ #ifndef __CLANG_CUDA_WRAPPERS_CMATH #define __CLANG_CUDA_WRAPPERS_CMATH +#if __has_include_next(<cmath>) #include_next <cmath> +#else +#error "Could not find standard C++ header 'cmath'. Add -v to your compilation command to check the include paths being searched. You may need to install the appropriate standard C++ library package corresponding to the search path." +#endif #if defined(_LIBCPP_STD_VER) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits