diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2015-02-23 09:53:16 -0800 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2015-04-30 17:57:30 -0700 |
commit | 57786f78a27e88ab3afae2cdd1253780a3572884 (patch) | |
tree | 9350ea49b13ff4c1970575598fa4bf18cab00831 | |
parent | 47d90e5fb8adc87a7c355452f47c2533495271f4 (diff) | |
download | clang-57786f78a27e88ab3afae2cdd1253780a3572884.tar.gz |
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
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | clang-device-build.mk | 7 | ||||
-rw-r--r-- | clang-host-build.mk | 7 |
3 files changed, 15 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk index d5495b3430..4120a7c0f4 100644 --- a/Android.mk +++ b/Android.mk @@ -1,5 +1,6 @@ LOCAL_PATH := $(call my-dir) CLANG_ROOT_PATH := $(LOCAL_PATH) +CLANG_ENABLE_ASSERTION := false include $(CLEAR_VARS) diff --git a/clang-device-build.mk b/clang-device-build.mk index 0bd088e967..28c7916f53 100644 --- a/clang-device-build.mk +++ b/clang-device-build.mk @@ -8,6 +8,13 @@ LOCAL_CPPFLAGS := \ -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 \ diff --git a/clang-host-build.mk b/clang-host-build.mk index 81e9b1ef0f..3594cc4f85 100644 --- a/clang-host-build.mk +++ b/clang-host-build.mk @@ -8,6 +8,13 @@ LOCAL_CPPFLAGS := \ -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 \ |