Add flag to enable assertions in Clang
Add a flag CLANG_ENABLE_ASSERTIONS to enable assertions in Clang,
similar to LLVM_ENABLE_ASSERTIONS in llvm.
Cherry-pick https://android-review.googlesource.com/#/c/134490/ from
AOSP
Change-Id: Id2a63516a98e4724f2157a41c0bfd621ff48bec3
diff --git a/clang-host-build.mk b/clang-host-build.mk
index 81e9b1e..3594cc4 100644
--- a/clang-host-build.mk
+++ b/clang-host-build.mk
@@ -8,6 +8,13 @@
-Wno-sign-promo \
$(LOCAL_CPPFLAGS)
+ifeq ($(CLANG_ENABLE_ASSERTION),true)
+LOCAL_CFLAGS := \
+ $(LOCAL_CFLAGS) \
+ -D_DEBUG \
+ -UNDEBUG
+endif
+
# Make sure bionic is first so we can include system headers.
LOCAL_C_INCLUDES := \
$(CLANG_ROOT_PATH)/include \