This is an archive of the discontinued LLVM Phabricator instance.

Allows to build libc++ with -DLLVM_USE_SANITIZER="Address;Undefined" on OSX
Needs ReviewPublic

Authored by mehdi_amini on Mar 9 2016, 2:59 PM.

Details

Reviewers
beanz
Summary

It seems some cases were missing to the configuration.

Diff Detail

Event Timeline

mehdi_amini updated this revision to Diff 50202.Mar 9 2016, 2:59 PM
mehdi_amini retitled this revision from to Allows to build libc++ with -DLLVM_USE_SANITIZER="Address;Undefined" on OSX.
mehdi_amini updated this object.
mehdi_amini added a reviewer: beanz.
mehdi_amini set the repository for this revision to rL LLVM.
mehdi_amini added a subscriber: cfe-commits.
beanz added inline comments.Mar 9 2016, 4:02 PM
lib/CMakeLists.txt
51

Rather than doing this as a STREQUAL where you have to check both possible orders, maybe we should iterate over the list?

Something more like:

foreach(sanitizer in ${LLVM_USE_SANITIZER})
  if(sanitizer STREQUAL "Address")
    set(enable_address On)
  endif()
  if(sanitizer STREQUAL "Undefined")
    set(enable_ub On)
  endif()
  ... <other sanitizers>
endforeach()

if(enable_address and enable_undefined)
...
elseif(...)
endif()

I think doing it this way makes the code more adaptable to future changes.

Alternatively you can get rid of needing to check both orders by using the list(FIND ...) CMake command, which might be cleaner too.

Thanks, that's a lot cleaner indeed. I'll update.