[libcxx] r229698 - Enable testing with _LIBCPP_DEBUG and fix bad assertions in string_view.

Eric Fiselier eric at efcs.ca
Wed Feb 18 09:00:31 PST 2015


Author: ericwf
Date: Wed Feb 18 11:00:31 2015
New Revision: 229698

URL: http://llvm.org/viewvc/llvm-project?rev=229698&view=rev
Log:
Enable testing with _LIBCPP_DEBUG and fix bad assertions in string_view.

Modified:
    libcxx/trunk/include/experimental/string_view
    libcxx/trunk/test/libcxx/test/config.py
    libcxx/trunk/www/lit_usage.html

Modified: libcxx/trunk/include/experimental/string_view
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/string_view?rev=229698&r1=229697&r2=229698&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/string_view (original)
+++ libcxx/trunk/include/experimental/string_view Wed Feb 18 11:00:31 2015
@@ -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;
         }
 

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=229698&r1=229697&r2=229698&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Wed Feb 18 11:00:31 2015
@@ -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:

Modified: libcxx/trunk/www/lit_usage.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/lit_usage.html?rev=229698&r1=229697&r2=229698&view=diff
==============================================================================
--- libcxx/trunk/www/lit_usage.html (original)
+++ libcxx/trunk/www/lit_usage.html Wed Feb 18 11:00:31 2015
@@ -175,6 +175,15 @@ Change the standard version used when bu
 </p>
 
 <p>
+<h3 class="lit-option">debug_level=<level></h3>
+<blockquote class="lit-option-desc">
+<b>Values: </b><code>0, 1</code></br>
+Enable the use of debug mode. Level 0 enables assertions and level 1 enables
+assertions and debugging of iterator misuse.
+</blockquote>
+</p>
+
+<p>
 <h3 class="lit-option">use_sanitizer=<sanitizer name></h3>
 <blockquote class="lit-option-desc">
 <b>Values: </b><code>Memory, MemoryWithOrigins, Address, Undefined</code></br>





More information about the cfe-commits mailing list