[compiler-rt] [compiler-rt] Don't detect a versioned clang test compiler as GCC (PR #117812)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 27 10:25:23 PST 2024


================
@@ -77,9 +77,9 @@ else()
   set(COMPILER_RT_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE PATH "C++ Compiler to use for testing")
 endif()
 
-if("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang[+]*$")
-  set(COMPILER_RT_TEST_COMPILER_ID Clang)
-elseif("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang.*.exe$")
+if ("${COMPILER_RT_TEST_COMPILER}" STREQUAL ${CMAKE_C_COMPILER})
----------------
compnerd wrote:

```suggestion
if("${COMPILER_RT_TEST_COMPILER}" STREQUAL "${CMAKE_C_COMPILER}")
```

The CMake style is to not have the space after `if` ... unlike the rest of the LLVM code. Additionally, I tend to always quote the parameters to `STREQUAL` as otherwise you may end up with an error if the variable is undefined.

https://github.com/llvm/llvm-project/pull/117812


More information about the llvm-commits mailing list