[PATCH] D10356: scan-build: Add --analyzer-target option

Ted Kremenek via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 7 15:18:21 PDT 2015


krememek added a comment.

In http://reviews.llvm.org/D10356#217564, @honggyu.kim wrote:

>




> With --analyzer-target option, we can provide target info to clang static analyzer as follows:

> 

> $ scan-build -v -v -v --analyzer-target=arm-linux-gnueabi --use-cc=arm-linux-gnueabi-gcc make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-

> 

>   ...

>   CC      arch/arm/kernel/opcodes.o

> 

> 1. compilation works the same as before ``` arm-linux-gnueabi-gcc ... -march=armv7-a ... -c -o arch/arm/kernel/opcodes.o arch/arm/kernel/opcodes.c ```

> 2. analysis uses the target triple that is given by --analyzer-target option and analysis works fine then. ``` 'clang' '-cc1' '-triple' 'armv7--linux-gnueabi' '-analyze' ... '-target-cpu' 'cortex-a8' ... 'arch/arm/kernel/opcodes.c') ```

> 

>   So we have to use the same target triple for compilation and analysis by using this option. Please let me know if there's a better way to fix this issue.


I see.  The problem is that the ad hoc interposition that scan-build uses does not handle the case that the underlying compiler is built as a cross-compiler, but does not take a direct target triple.  That compiler only builds for the other target, unlike clang which is a cross-compiler.

In that case, I am fine with taking this change.  That you for explaining it.


http://reviews.llvm.org/D10356





More information about the cfe-commits mailing list