Acommonproblem in program analysis is to identify semantically related statements in programs, for example, which statements change the value of a variable, or implement a specific feature or functionality. This is a very challenging task for large programs and gets even more complicated in the presence of variability implementations like #ifdef-annotations. Program slicing is a technique that can be used to aid developers with this challenge. But while slicing is a well-established technique for individual programs, there has been so far only little work on program slicing of product lines.
Here,we introduce a static-analysis approach for semantic slicing of product lines. Our approach introduces the novel concept of a variability-aware code property graph, which combines information about code properties (like statement type) and syntactical structure with data- and control-flow information. This graph is then traversed to gather semantically-related lines of code for a given entry node.We demonstrate our approach with a C-example, including preprocessor statements.