From 3f370b0a551580575e167259ef60c7b0dea96b9f Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 18 Feb 2015 17:00:31 +0000 Subject: [PATCH] Enable testing with _LIBCPP_DEBUG and fix bad assertions in string_view. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@229698 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/experimental/string_view | 4 ++-- test/libcxx/test/config.py | 10 ++++++++++ www/lit_usage.html | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/experimental/string_view b/include/experimental/string_view index d423f390..b8d061fb 100644 --- a/include/experimental/string_view +++ b/include/experimental/string_view @@ -313,7 +313,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY void remove_prefix(size_type __n) _NOEXCEPT { - _LIBCPP_ASSERT(n <= size(), "remove_prefix() can't remove more than size()"); + _LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()"); __data += __n; __size -= __n; } @@ -321,7 +321,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY void remove_suffix(size_type __n) _NOEXCEPT { - _LIBCPP_ASSERT(n <= size(), "remove_suffix() can't remove more than size()"); + _LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()"); __size -= __n; } diff --git a/test/libcxx/test/config.py b/test/libcxx/test/config.py index 43e3bb82..5633d3d0 100644 --- a/test/libcxx/test/config.py +++ b/test/libcxx/test/config.py @@ -91,6 +91,7 @@ class Configuration(object): self.configure_env() self.configure_compile_flags() self.configure_link_flags() + self.configure_debug_mode() self.configure_warnings() self.configure_sanitizer() self.configure_substitutions() @@ -468,6 +469,15 @@ class Configuration(object): else: self.lit_config.fatal("unrecognized system: %r" % target_platform) + def configure_debug_mode(self): + debug_level = self.get_lit_conf('debug_level', None) + if not debug_level: + return + if debug_level not in ['0', '1']: + self.lit_config.fatal('Invalid value for debug_level "%s".' + % debug_level) + self.cxx.compile_flags += ['-D_LIBCPP_DEBUG=%s' % debug_level] + def configure_warnings(self): enable_warnings = self.get_lit_bool('enable_warnings', False) if enable_warnings: diff --git a/www/lit_usage.html b/www/lit_usage.html index 645143fa..77179f21 100644 --- a/www/lit_usage.html +++ b/www/lit_usage.html @@ -174,6 +174,15 @@ Change the standard version used when building the tests.

+

+

debug_level=<level>

+
+Values: 0, 1
+Enable the use of debug mode. Level 0 enables assertions and level 1 enables +assertions and debugging of iterator misuse. +
+

+

use_sanitizer=<sanitizer name>