Replace LLVM_ENABLE_ASSERTION with FORCE_BUILD_LLVM_DISABLE_NDEBUG, and add FORCE_BUILD_LLVM_DEBUG.

FORCE_BUILD_LLVM_DISABLE_NDEBUG and FORCE_BUILD_LLVM_DEBUG are
environment variables analogous to FORCE_BUILD_LLVM_COMPONENTS.

FORCE_BUILD_LLVM_DISABLE_NDEBUG compiles with -D_DEBUG -UNDEBUG.  This
has the effect of enabling assert() and certain internal behaviors
(e.g., various LLVM sanity checks).  FORCE_BUILD_LLVM_DISABLE_NDEBUG
must be set consistently during builds of llvm, clang, libbcc, and
slang to avoid undefined behavior.

FORCE_BUILD_LLVM_DEBUG compiles host code (but not device code) with -O0 -g.

Depends on similar changes in llvm, clang, and libbcc.

Change-Id: Ic7cbfeb5fd97061c82a007324fb851eda2117f19
diff --git a/Android.mk b/Android.mk
index e0556e2..bd30cb7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -14,7 +14,18 @@
 # limitations under the License.
 #
 LOCAL_PATH := $(call my-dir)
-SLANG_ENABLE_ASSERTIONS := false
+
+FORCE_BUILD_LLVM_DISABLE_NDEBUG ?= false
+# Legality check: FORCE_BUILD_LLVM_DISABLE_NDEBUG should consist of one word -- either "true" or "false".
+ifneq "$(words $(FORCE_BUILD_LLVM_DISABLE_NDEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DISABLE_NDEBUG)))" "10"
+  $(error FORCE_BUILD_LLVM_DISABLE_NDEBUG may only be true, false, or unset)
+endif
+
+FORCE_BUILD_LLVM_DEBUG ?= false
+# Legality check: FORCE_BUILD_LLVM_DEBUG should consist of one word -- either "true" or "false".
+ifneq "$(words $(FORCE_BUILD_LLVM_DEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DEBUG)))" "10"
+  $(error FORCE_BUILD_LLVM_DEBUG may only be true, false, or unset)
+endif
 
 # The prebuilt tools should be used when we are doing app-only build.
 ifeq ($(TARGET_BUILD_APPS),)
@@ -34,10 +45,6 @@
 include $(LOCAL_PATH)/rs_version.mk
 local_cflags_for_slang += $(RS_VERSION_DEFINE)
 
-ifeq ($(SLANG_ENABLE_ASSERTIONS),true)
-local_cflags_for_slang += -D_DEBUG -UNDEBUG
-endif
-
 static_libraries_needed_by_slang := \
 	libLLVMBitWriter_2_9 \
 	libLLVMBitWriter_2_9_func \