summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2014-08-18 05:03:46 +0000
committerEric Fiselier <eric@efcs.ca>2014-08-18 05:03:46 +0000
commit0058c80cc7b08deaaad5eb22f8903d367bf592f8 (patch)
treeb807170b8d164de29cd0a97ed29987208356b540 /libcxx/test
parent9e7b17b0d484861350c4b818697b81e1bc8ac96a (diff)
downloadbcm5719-llvm-0058c80cc7b08deaaad5eb22f8903d367bf592f8.tar.gz
bcm5719-llvm-0058c80cc7b08deaaad5eb22f8903d367bf592f8.zip
[libcxx] Add support for LLVM_USE_SANITIZER to libcxx when being built standalone and in-tree
Summary: This patch adds support for LLVM_USE_SANITIZER when being built in-tree and standalone. This patch does the following things: 1. define the LLVM_USE_SANITIZER option to "" when being built standalone. This also helps show we support it. 2. Translate LLVM_USE_SANITIZER when standalone in a very similar way done in llvm/cmake/HandleLLVMOptions.cmake. 3. Add config.llvm_use_sanitizer to lit.site.cfg.in 4. Add code to translate config.llvm_use_sanitizer's value into the needed compile flags in lit.cfg. Currently lit.cfg assumes that that the compiler supports '-fno-omit-frame-pointer' while CMakeLists.txt actually checks to see if its supported. We could pass this information to lit but I'm not sure its needed. Reviewers: mclow.lists, danalbert Reviewed By: danalbert Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4949 llvm-svn: 215872
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/lit.cfg16
-rw-r--r--libcxx/test/lit.site.cfg.in1
2 files changed, 17 insertions, 0 deletions
diff --git a/libcxx/test/lit.cfg b/libcxx/test/lit.cfg
index edb0ab0d3cc..f41187b86a0 100644
--- a/libcxx/test/lit.cfg
+++ b/libcxx/test/lit.cfg
@@ -314,6 +314,22 @@ else:
lit_config.note('using user specified std: \'-std={}\''.format(std))
compile_flags += ['-std={}'.format(std)]
+built_w_san = getattr(config, 'llvm_use_sanitizer')
+if built_w_san and built_w_san.strip():
+ built_w_san = built_w_san.strip()
+ compile_flags += ['-fno-omit-frame-pointer']
+ if built_w_san == 'Address':
+ compile_flags += ['-fsanitize=address']
+ config.available_features.add('asan')
+ elif built_w_san == 'Memory' or built_w_san == 'MemoryWithOrigins':
+ compile_flags += ['-fsanitize=memory']
+ if built_w_san == 'MemoryWithOrigins':
+ compile_flags += ['-fsanitize-memory-track-origins']
+ config.available_features.add('msan')
+ else:
+ lit_config.fatal(
+ 'unsupported value for libcxx_use_sanitizer: {}'.format(built_w_san))
+
# Configure extra linker parameters.
exec_env = {}
if sys.platform == 'darwin':
diff --git a/libcxx/test/lit.site.cfg.in b/libcxx/test/lit.site.cfg.in
index 9ef332ca695..3362d99e09e 100644
--- a/libcxx/test/lit.site.cfg.in
+++ b/libcxx/test/lit.site.cfg.in
@@ -6,6 +6,7 @@ config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@"
config.python_executable = "@PYTHON_EXECUTABLE@"
config.enable_shared = @LIBCXX_ENABLE_SHARED@
config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@"
+config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
# Let the main config do the real work.
lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
OpenPOWER on IntegriCloud