Use newest clang static analyzers.

* When WITH_STATIC_ANALYZER is set and non-zero, and clang compiler is used,
  call new clang ccc-analyzer or c++-analyzer.
* Otherwise, if WITH_SYNTAX_CHECK is set and non-zero,
  call compiler with -fsyntax-only.
* Replace "--sysroot=path" with "--sysroot path", to work with ccc-analyzer.
* ccc-analyzer executes the original compilation command to generate
  object files before calling clang with --analyze to do static analysis.
* When clang is called with --analyze, macro __clang_analyzer__ is defined.

BUG: 13287788

(cherry picked from commit 765c1ea6d7272fae04d435b9bac79087a2f6aabf)

Change-Id: I6e51e51ff4ed3ce514f60d090494dcdf6e520b04
diff --git a/core/config.mk b/core/config.mk
index d877170..aa68895 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -355,20 +355,18 @@
   WITH_SYNTAX_CHECK :=
 endif
 
+# define clang/llvm versions and base directory.
+include $(BUILD_SYSTEM)/clang/versions.mk
+
 # Disable WITH_STATIC_ANALYZER and WITH_SYNTAX_CHECK if tool can't be found
-SYNTAX_TOOLS_PREFIX := prebuilts/misc/$(HOST_PREBUILT_TAG)/analyzer/bin
+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
-ifneq ($(strip $(WITH_SYNTAX_CHECK)),)
-  ifeq ($(wildcard $(SYNTAX_TOOLS_PREFIX)/ccc-syntax),)
-    $(warning *** Disable WITH_SYNTAX_CHECK because $(SYNTAX_TOOLS_PREFIX)/ccc-syntax does not exist)
-    WITH_SYNTAX_CHECK :=
-  endif
-endif
 
 # WITH_STATIC_ANALYZER trumps WITH_SYNTAX_CHECK
 ifneq ($(strip $(WITH_STATIC_ANALYZER)),)