Use generic feature name for sanitizers that replace new and delete

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231841 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2015-03-10 20:46:04 +00:00
parent c6c1a1ee75
commit 07a4bec1dd
36 changed files with 39 additions and 35 deletions

View File

@@ -544,6 +544,7 @@ class Configuration(object):
if llvm_symbolizer is not None: if llvm_symbolizer is not None:
self.env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer self.env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer
self.config.available_features.add('asan') self.config.available_features.add('asan')
self.config.available_features.add('sanitizer-new-delete')
elif san == 'Memory' or san == 'MemoryWithOrigins': elif san == 'Memory' or san == 'MemoryWithOrigins':
self.cxx.flags += ['-fsanitize=memory'] self.cxx.flags += ['-fsanitize=memory']
if san == 'MemoryWithOrigins': if san == 'MemoryWithOrigins':
@@ -552,6 +553,7 @@ class Configuration(object):
if llvm_symbolizer is not None: if llvm_symbolizer is not None:
self.env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer self.env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer
self.config.available_features.add('msan') self.config.available_features.add('msan')
self.config.available_features.add('sanitizer-new-delete')
elif san == 'Undefined': elif san == 'Undefined':
self.cxx.flags += ['-fsanitize=undefined', self.cxx.flags += ['-fsanitize=undefined',
'-fno-sanitize=vptr,function', '-fno-sanitize=vptr,function',
@@ -561,6 +563,7 @@ class Configuration(object):
elif san == 'Thread': elif san == 'Thread':
self.cxx.flags += ['-fsanitize=thread'] self.cxx.flags += ['-fsanitize=thread']
self.config.available_features.add('tsan') self.config.available_features.add('tsan')
self.config.available_features.add('sanitizer-new-delete')
else: else:
self.lit_config.fatal('unsupported value for ' self.lit_config.fatal('unsupported value for '
'use_sanitizer: {0}'.format(san)) 'use_sanitizer: {0}'.format(san))

View File

@@ -12,7 +12,7 @@
// template <InputIterator Iter> // template <InputIterator Iter>
// iterator insert(const_iterator position, Iter first, Iter last); // iterator insert(const_iterator position, Iter first, Iter last);
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#if _LIBCPP_DEBUG >= 1 #if _LIBCPP_DEBUG >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))

View File

@@ -11,7 +11,7 @@
// iterator insert(const_iterator position, size_type n, const value_type& x); // iterator insert(const_iterator position, size_type n, const value_type& x);
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#if _LIBCPP_DEBUG >= 1 #if _LIBCPP_DEBUG >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))

View File

@@ -11,7 +11,7 @@
// iterator insert(const_iterator position, const value_type& x); // iterator insert(const_iterator position, const value_type& x);
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#if _LIBCPP_DEBUG >= 1 #if _LIBCPP_DEBUG >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))

View File

@@ -9,7 +9,7 @@
// test operator new[] // test operator new[]
// NOTE: asan and msan will not call the new handler. // NOTE: asan and msan will not call the new handler.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>

View File

@@ -9,7 +9,7 @@
// test operator new [] (nothrow) // test operator new [] (nothrow)
// NOTE: asan and msan will not call the new handler. // NOTE: asan and msan will not call the new handler.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>

View File

@@ -9,7 +9,7 @@
// test operator new [] nothrow by replacing only operator new // test operator new [] nothrow by replacing only operator new
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -9,7 +9,7 @@
// test operator new[] replacement by replacing only operator new // test operator new[] replacement by replacing only operator new
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -9,7 +9,7 @@
// test sized operator delete[] by replacing unsized operator delete[]. // test sized operator delete[] by replacing unsized operator delete[].
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -10,7 +10,7 @@
// test nothrow sized operator delete[] by replacing // test nothrow sized operator delete[] by replacing
// nothrow unsized operator delete[]. // nothrow unsized operator delete[].
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -12,7 +12,7 @@
// Note that sized delete operator definitions below are simply ignored // Note that sized delete operator definitions below are simply ignored
// when sized deallocation is not supported, e.g., prior to C++14. // when sized deallocation is not supported, e.g., prior to C++14.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -12,7 +12,7 @@
// Note that sized delete operator definitions below are simply ignored // Note that sized delete operator definitions below are simply ignored
// when sized deallocation is not supported, e.g., prior to C++14. // when sized deallocation is not supported, e.g., prior to C++14.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -10,7 +10,7 @@
// test operator new // test operator new
// asan and msan will not call the new handler. // asan and msan will not call the new handler.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -10,7 +10,7 @@
// test operator new (nothrow) // test operator new (nothrow)
// asan and msan will not call the new handler. // asan and msan will not call the new handler.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -9,7 +9,7 @@
// test operator new nothrow by replacing only operator new // test operator new nothrow by replacing only operator new
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -9,7 +9,7 @@
// test operator new replacement // test operator new replacement
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -9,7 +9,7 @@
// test sized operator delete by replacing unsized operator delete. // test sized operator delete by replacing unsized operator delete.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -10,7 +10,7 @@
// test nothrow sized operator delete by replacing // test nothrow sized operator delete by replacing
// nothrow unsized operator delete. // nothrow unsized operator delete.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -12,7 +12,7 @@
// Note that sized delete operator definitions below are simply ignored // Note that sized delete operator definitions below are simply ignored
// when sized deallocation is not supported, e.g., prior to C++14. // when sized deallocation is not supported, e.g., prior to C++14.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -12,7 +12,7 @@
// Note that sized delete operator definitions below are simply ignored // Note that sized delete operator definitions below are simply ignored
// when sized deallocation is not supported, e.g., prior to C++14. // when sized deallocation is not supported, e.g., prior to C++14.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <new> #include <new>
#include <cstddef> #include <cstddef>

View File

@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: msan, asan // UNSUPPORTED: sanitizer-new-delete
// <locale> // <locale>

View File

@@ -9,7 +9,7 @@
// REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8 // REQUIRES: locale.zh_CN.UTF-8
// UNSUPPORTED: msan, asan // UNSUPPORTED: sanitizer-new-delete
// <locale> // <locale>

View File

@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.fr_FR.UTF-8
// UNSUPPORTED: msan, asan // UNSUPPORTED: sanitizer-new-delete
// <locale> // <locale>

View File

@@ -9,7 +9,7 @@
// REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: msan, asan // UNSUPPORTED: sanitizer-new-delete
// <locale> // <locale>

View File

@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: msan, asan // UNSUPPORTED: sanitizer-new-delete
// <locale> // <locale>

View File

@@ -9,7 +9,7 @@
// REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: msan, asan // UNSUPPORTED: sanitizer-new-delete
// <locale> // <locale>

View File

@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: msan, asan // UNSUPPORTED: sanitizer-new-delete
// <locale> // <locale>

View File

@@ -9,7 +9,7 @@
// REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8 // REQUIRES: locale.zh_CN.UTF-8
// UNSUPPORTED: msan, asan // UNSUPPORTED: sanitizer-new-delete
// <locale> // <locale>

View File

@@ -16,7 +16,7 @@
// returns null. // returns null.
// 2. If allocator_may_return_null=1 then they will fail because the allocation // 2. If allocator_may_return_null=1 then they will fail because the allocation
// is too large to succeed. // is too large to succeed.
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <string> #include <string>
#include <cassert> #include <cassert>

View File

@@ -15,7 +15,7 @@
// template <class F, class ...Args> thread(F&& f, Args&&... args); // template <class F, class ...Args> thread(F&& f, Args&&... args);
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <thread> #include <thread>
#include <new> #include <new>

View File

@@ -11,7 +11,7 @@
// template<class Y> explicit shared_ptr(auto_ptr<Y>&& r); // template<class Y> explicit shared_ptr(auto_ptr<Y>&& r);
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <memory> #include <memory>
#include <new> #include <new>

View File

@@ -13,7 +13,7 @@
// template<class D> shared_ptr(nullptr_t, D d); // template<class D> shared_ptr(nullptr_t, D d);
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <memory> #include <memory>
#include <cassert> #include <cassert>

View File

@@ -13,7 +13,7 @@
// template<class Y, class D> shared_ptr(Y* p, D d); // template<class Y, class D> shared_ptr(Y* p, D d);
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <memory> #include <memory>
#include <cassert> #include <cassert>

View File

@@ -11,7 +11,7 @@
// template<class Y> explicit shared_ptr(Y* p); // template<class Y> explicit shared_ptr(Y* p);
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <memory> #include <memory>
#include <new> #include <new>

View File

@@ -11,7 +11,7 @@
// template <class Y, class D> explicit shared_ptr(unique_ptr<Y, D>&&r); // template <class Y, class D> explicit shared_ptr(unique_ptr<Y, D>&&r);
// UNSUPPORTED: asan, msan // UNSUPPORTED: sanitizer-new-delete
#include <memory> #include <memory>
#include <new> #include <new>

View File

@@ -10,7 +10,8 @@
#endif #endif
#if __has_feature(address_sanitizer) \ #if __has_feature(address_sanitizer) \
|| __has_feature(memory_sanitizer) || __has_feature(memory_sanitizer) \
|| __has_feature(thread_sanitizer)
#define DISABLE_NEW_COUNT #define DISABLE_NEW_COUNT
#endif #endif