采用Clang/LLVM的C++源代码覆盖率分析插装方法 (Approach to C++ Code Instrumentation for Coverage Analysis with Clang/LLVM)

In recent years ,many safety-critical software system have been running under domestic Linux operating sys tems , most of which are developed with C十十. As C十十 is expanding to new revision of the C十十 lSO/IEC stan dards , the existing source code instrumentation tools for coverage analysis cannot satisfy user' s requirements. In this paper , an approach to C十十 source code instrumentation for coverage analysis with Clang/LL VM was proposed. Em ploying the Clang/LL VM library in open source community, which provides C+ + source code parsing and manipula tion functions , a framework of C十+ coverage analysis for statement coverage , branch coverage and MC/DC coverage was constructed. Coverage information was collected in real-time , and was analyzed and exported to reports. Case study shows that the proposed approach is very convenient and practical in real world software testing activities.