Remove core/clang/versions.mk and scan-build wrapper
* Use the definitions of ClangDefaultBase and ClangDefaultVersion
in build/soong/cc/config/global.go.
* scan-build is too old;
replaced by better clang-tidy's -clang-analyzer-* checks.
* WITH_STATIC_ANALYZER is still effective
to invoke ccc-analyzer or c++-analyzer.
Test: make checkbuild
Change-Id: Ifd159dd28e529d5d3c9807f5e391911365da8cdb
diff --git a/core/binary.mk b/core/binary.mk
index e3da7d2..334cb2e 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -617,6 +617,9 @@
my_cc := $(my_cc_wrapper) $(my_cc)
endif
+SYNTAX_TOOLS_PREFIX := \
+ $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/libexec
+
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
my_cc := CCC_CC=$(CLANG) CLANG=$(CLANG) \
$(SYNTAX_TOOLS_PREFIX)/ccc-analyzer
diff --git a/core/clang/versions.mk b/core/clang/versions.mk
deleted file mode 100644
index 1e41f92..0000000
--- a/core/clang/versions.mk
+++ /dev/null
@@ -1,4 +0,0 @@
-## Clang/LLVM release versions.
-
-LLVM_PREBUILTS_VERSION ?= clang-4579689
-LLVM_PREBUILTS_BASE ?= prebuilts/clang/host
diff --git a/core/config.mk b/core/config.mk
index 64743e0..f07e96b 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -413,33 +413,11 @@
WITH_STATIC_ANALYZER :=
endif
-# define clang/llvm versions and base directory.
-include $(BUILD_SYSTEM)/clang/versions.mk
-
# Unset WITH_TIDY_ONLY if global WITH_TIDY_ONLY is not true nor 1.
ifeq (,$(filter 1 true,$(WITH_TIDY_ONLY)))
WITH_TIDY_ONLY :=
endif
-PATH_TO_CLANG_TIDY := \
- $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/bin/clang-tidy
-ifeq ($(wildcard $(PATH_TO_CLANG_TIDY)),)
- ifneq (,$(filter 1 true,$(WITH_TIDY)))
- $(warning *** Disable WITH_TIDY because $(PATH_TO_CLANG_TIDY) does not exist)
- endif
- PATH_TO_CLANG_TIDY :=
-endif
-
-# Disable WITH_STATIC_ANALYZER if tool can't be found
-SYNTAX_TOOLS_PREFIX := \
- $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/tools/scan-build/libexec
-ifneq ($(strip $(WITH_STATIC_ANALYZER)),)
- ifeq ($(wildcard $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer),)
- $(warning *** Disable WITH_STATIC_ANALYZER because $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer does not exist)
- WITH_STATIC_ANALYZER :=
- endif
-endif
-
# Pick a Java compiler.
include $(BUILD_SYSTEM)/combo/javac.mk
diff --git a/envsetup.sh b/envsetup.sh
index 372dffb..cf61950 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -741,33 +741,11 @@
fi
}
-# Return driver for "make", if any (eg. static analyzer)
-function getdriver()
-{
- local T="$1"
- test "$WITH_STATIC_ANALYZER" = "0" && unset WITH_STATIC_ANALYZER
- if [ -n "$WITH_STATIC_ANALYZER" ]; then
- # Use scan-build to collect all static analyzer reports into directory
- # /tmp/scan-build-yyyy-mm-dd-hhmmss-*
- # The clang compiler passed by --use-analyzer here is not important.
- # build/make/core/binary.mk will set CLANG_CXX and CLANG before calling
- # c++-analyzer and ccc-analyzer.
- local CLANG_VERSION=$(get_build_var LLVM_PREBUILTS_VERSION)
- local BUILD_OS=$(get_build_var BUILD_OS)
- local CLANG_DIR="$T/prebuilts/clang/host/${BUILD_OS}-x86/${CLANG_VERSION}"
- echo "\
-${CLANG_DIR}/tools/scan-build/bin/scan-build \
---use-analyzer ${CLANG_DIR}/bin/clang \
---status-bugs"
- fi
-}
-
function m()
{
local T=$(gettop)
- local DRV=$(getdriver $T)
if [ "$T" ]; then
- _wrap_build $DRV $T/build/soong/soong_ui.bash --make-mode $@
+ _wrap_build $T/build/soong/soong_ui.bash --make-mode $@
else
echo "Couldn't locate the top of the tree. Try setting TOP."
return 1
@@ -794,11 +772,10 @@
function mm()
{
local T=$(gettop)
- local DRV=$(getdriver $T)
# If we're sitting in the root of the build tree, just do a
# normal build.
if [ -f build/soong/soong_ui.bash ]; then
- _wrap_build $DRV $T/build/soong/soong_ui.bash --make-mode $@
+ _wrap_build $T/build/soong/soong_ui.bash --make-mode $@
else
# Find the closest Android.mk file.
local M=$(findmakefile)
@@ -833,7 +810,7 @@
if [ "1" = "${WITH_TIDY_ONLY}" -o "true" = "${WITH_TIDY_ONLY}" ]; then
MODULES=tidy_only
fi
- ONE_SHOT_MAKEFILE=$M _wrap_build $DRV $T/build/soong/soong_ui.bash --make-mode $MODULES $ARGS
+ ONE_SHOT_MAKEFILE=$M _wrap_build $T/build/soong/soong_ui.bash --make-mode $MODULES $ARGS
fi
fi
}
@@ -841,7 +818,6 @@
function mmm()
{
local T=$(gettop)
- local DRV=$(getdriver $T)
if [ "$T" ]; then
local MAKEFILE=
local MODULES=
@@ -901,7 +877,7 @@
fi
# Convert "/" to "-".
MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
- ONE_SHOT_MAKEFILE="$MAKEFILE" _wrap_build $DRV $T/build/soong/soong_ui.bash --make-mode $DASH_ARGS $MODULES $MODULES_IN_PATHS $ARGS
+ ONE_SHOT_MAKEFILE="$MAKEFILE" _wrap_build $T/build/soong/soong_ui.bash --make-mode $DASH_ARGS $MODULES $MODULES_IN_PATHS $ARGS
else
echo "Couldn't locate the top of the tree. Try setting TOP."
return 1
@@ -911,9 +887,8 @@
function mma()
{
local T=$(gettop)
- local DRV=$(getdriver $T)
if [ -f build/soong/soong_ui.bash ]; then
- _wrap_build $DRV $T/build/soong/soong_ui.bash --make-mode $@
+ _wrap_build $T/build/soong/soong_ui.bash --make-mode $@
else
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP."
@@ -925,14 +900,13 @@
local MODULES_IN_PATHS=MODULES-IN-$(dirname ${M})
# Convert "/" to "-".
MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
- _wrap_build $DRV $T/build/soong/soong_ui.bash --make-mode $@ $MODULES_IN_PATHS
+ _wrap_build $T/build/soong/soong_ui.bash --make-mode $@ $MODULES_IN_PATHS
fi
}
function mmma()
{
local T=$(gettop)
- local DRV=$(getdriver $T)
if [ "$T" ]; then
local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
@@ -963,7 +937,7 @@
done
# Convert "/" to "-".
MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
- _wrap_build $DRV $T/build/soong/soong_ui.bash --make-mode $DASH_ARGS $ARGS $MODULES_IN_PATHS
+ _wrap_build $T/build/soong/soong_ui.bash --make-mode $DASH_ARGS $ARGS $MODULES_IN_PATHS
else
echo "Couldn't locate the top of the tree. Try setting TOP."
return 1