make: add __clang_analyzer__ to clang-tidy
We have code that acts slightly differently when the static analyzer is running, so that it can produce more accurate diagnostics (e.g. less false positives). It uses __clang_analyzer__ to detect the static analyzer. When the static analyzer is run via clang-tidy, __clang_analyzer__ doesn't get defined. Bug: None Test: WITH_TIDY=1 m. clang-tidy now acts as expected in code made for the static analyzer Change-Id: Ib2a815c0bd67553af465b64207bb480fb52cfaf8
This commit is contained in:
parent
c59d10fd1a
commit
5ab07d4f14
|
@ -1684,6 +1684,12 @@ ifneq (,$(filter 1 true,$(my_tidy_enabled)))
|
|||
ifeq ($(my_tidy_flags),)
|
||||
my_tidy_flags := $(call default_tidy_header_filter,$(LOCAL_PATH))
|
||||
endif
|
||||
|
||||
# We might be using the static analyzer through clang-tidy.
|
||||
# https://bugs.llvm.org/show_bug.cgi?id=32914
|
||||
ifneq ($(my_tidy_checks),)
|
||||
my_tidy_flags += "-extra-arg-before=-D__clang_analyzer__"
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue