gn: enable libc++ assertions in debug mode

This enables a bunch of useful assertions in libc++ which are very
useful when debugging issues. For example: bounds checking on vectors
and dereferencing std::optional are both invaluable IMO.

After running our unit/integration/diff tests with this patch, there
is a negligible difference in runtime.

Change-Id: I0e408fcb01fdde69a25309d7d358f5f2fed5833c
diff --git a/gn/standalone/libc++/BUILD.gn b/gn/standalone/libc++/BUILD.gn
index 49d91ba..c6ae0c1 100644
--- a/gn/standalone/libc++/BUILD.gn
+++ b/gn/standalone/libc++/BUILD.gn
@@ -21,10 +21,11 @@
       "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
     ]
     if (is_debug) {
-      # libc++ has two levels of debug mode. Setting _LIBCPP_DEBUG to zero
-      # enables most assertions. Setting it to one additionally enables iterator
-      # debugging, but that seems to require some extra link-time dependencies.
-      # See https://libcxx.llvm.org/docs/DesignDocs/DebugMode.html
+      # Enable "lightweight" assertions in libc++ (e.g. bounds checking, empty
+      # optional dereferencing etc) with _LIBCPP_ENABLE_ASSERTIONS but do not
+      # enable iterator debugging with _LIBCPP_DEBUG (which can be very
+      # expensive).
+      defines += [ "_LIBCPP_ENABLE_ASSERTIONS=1" ]
       defines += [ "_LIBCPP_DEBUG=0" ]
     }
     cflags_cc = [