diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-03-26 19:25:01 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-03-26 19:25:01 +0000 |
| commit | 8ce6499bdd80529ca602405ad406804c090d76ce (patch) | |
| tree | eeb94943df6aaacd51d0569df39c5ccab6a472fa /llvm/cmake/modules | |
| parent | 54dd7df1c086f8484263d3b03f1885d7ba7a07ab (diff) | |
| download | bcm5719-llvm-8ce6499bdd80529ca602405ad406804c090d76ce.tar.gz bcm5719-llvm-8ce6499bdd80529ca602405ad406804c090d76ce.zip | |
[ADT][CMake][AutoConf] Fail-fast iterators for DenseMap
Summary:
This patch is an attempt at making `DenseMapIterator`s "fail-fast".
Fail-fast iterators that have been invalidated due to insertion into
the host `DenseMap` deterministically trip an assert (in debug mode)
on access, instead of non-deterministically hitting memory corruption
issues.
Enabling fail-fast iterators breaks the LLVM C++ ABI, so they are
predicated on `LLVM_ENABLE_ABI_BREAKING_CHECKS`.
`LLVM_ENABLE_ABI_BREAKING_CHECKS` by default flips with
`LLVM_ENABLE_ASSERTS`, but can be clamped to ON or OFF using the CMake /
autoconf build system.
Reviewers: chandlerc, dexonsmith, rnk, zturner
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D8351
llvm-svn: 233310
Diffstat (limited to 'llvm/cmake/modules')
| -rw-r--r-- | llvm/cmake/modules/HandleLLVMOptions.cmake | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index 2878f4d2e6e..67f86a64526 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -78,6 +78,20 @@ if( LLVM_ENABLE_ASSERTIONS ) endif() endif() +string(TOUPPER "${LLVM_ABI_BREAKING_CHECKS}" uppercase_LLVM_ABI_BREAKING_CHECKS) + +if( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "WITH_ASSERTS" ) + if( LLVM_ENABLE_ASSERTIONS ) + set( LLVM_ENABLE_ABI_BREAKING_CHECKS 1 ) + endif() +elseif( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "FORCE_ON" ) + set( LLVM_ENABLE_ABI_BREAKING_CHECKS 1 ) +elseif( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "FORCE_OFF" ) + # We don't need to do anything special to turn off ABI breaking checks. +else() + message(FATAL_ERROR "Unknown value for LLVM_ABI_BREAKING_CHECKS: \"${LLVM_ABI_BREAKING_CHECKS}\"!") +endif() + if(WIN32) set(LLVM_HAVE_LINK_VERSION_SCRIPT 0) if(CYGWIN) |

