Skip to content

Commit

Permalink
Make NDK_ANALYZE work with both GCC and Clang.
Browse files Browse the repository at this point in the history
Not sure why this was ever hard wired to GCC. We can support both
easily enough.

Test: ndk-build NDK_ANALYZE=1 V=1
Test: ndk-build NDK_ANALYZE=1 V=1 NDK_TOOLCHAIN_VERSION=4.9
Bug: android/ndk#362
Change-Id: I378b95f76225ac09d0e0abe89d4d6022e74c8bd7
  • Loading branch information
DanAlbert committed May 31, 2017
1 parent 90ec78f commit 65ac457
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions build/ndk-build
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,23 @@ if [ "$NDK_ANALYZE" = 1 ]; then
}

APP_ABIS=`get_build_var APP_ABI`
TOOLCHAIN=`get_build_var NDK_TOOLCHAIN_VERSION`
for ABI in $APP_ABIS; do
TOOLCHAIN_PREFIX=`get_build_var_for_abi TOOLCHAIN_PREFIX $ABI`
LLVM_PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$HOST_TAG

if [ "$TOOLCHAIN" = "clang" ]; then
ANALYZER_CC=$LLVM_PATH/bin/clang
ANALYZER_CXX=$LLVM_PATH/bin/clang++
else
ANALYZER_CC=${TOOLCHAIN_PREFIX}gcc
ANALYZER_CXX=${TOOLCHAIN_PREFIX}g++
fi

perl $LLVM_PATH/tools/scan-build/bin/scan-build \
--use-analyzer $LLVM_PATH/bin/${ABI}/analyzer \
--use-cc ${TOOLCHAIN_PREFIX}gcc \
--use-c++ ${TOOLCHAIN_PREFIX}g++ \
--use-cc $ANALYZER_CC \
--use-c++ $ANALYZER_CXX \
--status-bugs \
$GNUMAKE -f $PROGDIR/core/build-local.mk "$@" APP_ABI=$ABI
done
Expand Down

0 comments on commit 65ac457

Please sign in to comment.