首先我input命令:
clang -cc1 -analyzer-checker-help
列出所有可用的检查程序如下。
alpha.core.BoolAssignment Warn about assigning non-{0,1} values to Boolean variables alpha.core.CastSize Check when casting a malloc'ed type T,whether the size is a multiple of the size of T alpha.core.CastToStruct Check for cast from non-struct pointer to struct pointer alpha.core.FixedAddr Check for assignment of a fixed address to a pointer alpha.core.Pointerarithm Check for pointer arithmetic on locations other than array elements alpha.core.PointerSub Check for pointer subtractions on two pointers pointing to different memory chunks alpha.core.SizeofPtr Warn about unintended use of sizeof() on pointer expressions alpha.cplusplus.VirtualCall Check virtual function calls during construction or destruction ......................................
然后我select两个(BoolAssignment和VirtualCall)来testing,代码如下:
int f1(){ int a=5; short b=4; bool a1=a;//maybe warn bool b1=b;//maybe warn if(a1&&b1)return 1; return 0; } class M{ public: virtual int GetAge(){return 0;} }; class P:public M{ public: virtual int GetAge(){return 1;} P(){GetAge();}//maybe warn ~P(){GetAge();}//maybe warn };
但什么也没有发生,怎么了? 这是我调用checkes的命令
gprof从Qtdebugging应用程序读取gmon.out输出的问题
用于分析的Linux库
Windows任务pipe理器显示内存使用不正确?
查找Windows应用程序的真实内存占用情况
JBoss Profiler:无法访问jarfile
scan-build --use-analyzer=/usr/bin/clang clang++ test.cpp -c -o test.o
Windows Eclipse CDT分析器
Windows上的C ++分析器
在Linux中分析部分程序
在armCortex_A8上进行检测
CUDA – 关于“分支”和“分支”Visual Profiler结果的混淆(2)
alpha.core.BoolAssignment默认情况下不是检查。 您必须使用-enable-checker选项启用它。 所以命令是:
scan-build –use-analyzer = / usr / bin / clang -enable-checker alpha.core.BoolAssignment clang ++ test.cpp -c -o test.o
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。