2014-03-11 02:23:08 +01:00
|
|
|
## Clang configurations.
|
|
|
|
|
2016-02-04 20:43:41 +01:00
|
|
|
LLVM_RTLIB_PATH := $(LLVM_PREBUILTS_PATH)/../lib64/clang/$(LLVM_RELEASE_VERSION)/lib/linux/
|
2014-02-19 18:03:00 +01:00
|
|
|
|
2014-09-30 11:37:20 +02:00
|
|
|
CLANG_TBLGEN := $(BUILD_OUT_EXECUTABLES)/clang-tblgen$(BUILD_EXECUTABLE_SUFFIX)
|
|
|
|
LLVM_TBLGEN := $(BUILD_OUT_EXECUTABLES)/llvm-tblgen$(BUILD_EXECUTABLE_SUFFIX)
|
2014-02-07 03:08:44 +01:00
|
|
|
|
2016-05-19 23:39:25 +02:00
|
|
|
define convert-to-clang-flags
|
|
|
|
$(strip $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(1)))
|
|
|
|
endef
|
2014-02-07 03:08:44 +01:00
|
|
|
|
2015-04-17 03:07:07 +02:00
|
|
|
CLANG_DEFAULT_UB_CHECKS := \
|
|
|
|
bool \
|
|
|
|
integer-divide-by-zero \
|
|
|
|
return \
|
|
|
|
returns-nonnull-attribute \
|
|
|
|
shift-exponent \
|
|
|
|
unreachable \
|
|
|
|
vla-bound \
|
|
|
|
|
|
|
|
# TODO(danalbert): The following checks currently have compiler performance
|
|
|
|
# issues.
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += alignment
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += bounds
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += enum
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += float-cast-overflow
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += float-divide-by-zero
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += nonnull-attribute
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += null
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += shift-base
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += signed-integer-overflow
|
|
|
|
|
|
|
|
# TODO(danalbert): Fix UB in libc++'s __tree so we can turn this on.
|
|
|
|
# https://llvm.org/PR19302
|
|
|
|
# http://reviews.llvm.org/D6974
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += object-size
|
|
|
|
|
2014-02-07 03:08:44 +01:00
|
|
|
# HOST config
|
2014-04-17 19:03:35 +02:00
|
|
|
clang_2nd_arch_prefix :=
|
2014-02-07 03:08:44 +01:00
|
|
|
include $(BUILD_SYSTEM)/clang/HOST_$(HOST_ARCH).mk
|
2014-04-17 19:03:35 +02:00
|
|
|
|
|
|
|
# HOST_2ND_ARCH config
|
|
|
|
ifdef HOST_2ND_ARCH
|
|
|
|
clang_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/clang/HOST_$(HOST_2ND_ARCH).mk
|
2014-03-20 21:48:35 +01:00
|
|
|
endif
|
2014-02-07 03:08:44 +01:00
|
|
|
|
2016-02-06 01:20:19 +01:00
|
|
|
ifdef HOST_CROSS_ARCH
|
|
|
|
clang_2nd_arch_prefix :=
|
|
|
|
include $(BUILD_SYSTEM)/clang/HOST_CROSS_$(HOST_CROSS_ARCH).mk
|
|
|
|
ifdef HOST_CROSS_2ND_ARCH
|
|
|
|
clang_2nd_arch_prefix := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/clang/HOST_CROSS_$(HOST_CROSS_2ND_ARCH).mk
|
|
|
|
endif
|
2015-08-14 21:59:50 +02:00
|
|
|
endif
|
|
|
|
|
2014-02-07 03:08:44 +01:00
|
|
|
# TARGET config
|
|
|
|
clang_2nd_arch_prefix :=
|
|
|
|
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_ARCH).mk
|
|
|
|
|
|
|
|
# TARGET_2ND_ARCH config
|
|
|
|
ifdef TARGET_2ND_ARCH
|
|
|
|
clang_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_2ND_ARCH).mk
|
|
|
|
endif
|
|
|
|
|
|
|
|
# This allows us to use the superset of functionality that compiler-rt
|
|
|
|
# provides to Clang (for supporting features like -ftrapv).
|
|
|
|
COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
|
2014-11-06 23:11:33 +01:00
|
|
|
|
2016-08-02 23:22:06 +02:00
|
|
|
# A list of projects that are allowed to set LOCAL_CLANG to false.
|
2016-08-03 20:39:02 +02:00
|
|
|
# INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS is defined later in other config.mk.
|
|
|
|
LOCAL_CLANG_EXCEPTION_PROJECTS = \
|
2016-08-03 19:42:10 +02:00
|
|
|
bionic/tests/ \
|
2016-08-02 23:22:06 +02:00
|
|
|
device/huawei/angler/ \
|
|
|
|
device/lge/bullhead/ \
|
2016-08-05 00:35:51 +02:00
|
|
|
external/gentoo/integration/ \
|
2016-08-02 23:22:06 +02:00
|
|
|
hardware/qcom/ \
|
2016-08-03 23:44:27 +02:00
|
|
|
test/vts/hals/camera/bullhead/ \
|
|
|
|
test/vts/hals/etc/libqdutils/ \
|
2017-03-21 20:21:28 +01:00
|
|
|
vendor/huawei/angler/ \
|
|
|
|
vendor/lge/bullhead/ \
|
2016-08-02 23:22:06 +02:00
|
|
|
$(INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS)
|
|
|
|
|
|
|
|
# Find $1 in the exception project list.
|
|
|
|
define find_in_local_clang_exception_projects
|
|
|
|
$(subst $(space),, \
|
|
|
|
$(foreach project,$(LOCAL_CLANG_EXCEPTION_PROJECTS), \
|
|
|
|
$(if $(filter $(project)%,$(1)),$(project)) \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2016-04-22 00:37:24 +02:00
|
|
|
include $(BUILD_SYSTEM)/clang/tidy.mk
|