slicer
slicer copied to clipboard
Slicing tool for c++ programs using clang AST.
Slicing:
Tasks need to be done:
- make matcher either for every type of node which is using a variable, or a generalized one.
- handle continue and break statements in a loop, regarding data dependence
- correct the data dependence builder algorithm when dealing with nested CompoundStatements in a loop
- add more tests
Aspects of performance:
- what should be stored
- how should it be stored (maybe JSON)
Program structure:
- Get source file, and line no.
- Parse AST via ASTMatchers and create the Statement graph.
- Insert data dependence edges to it.
- Compute slice regarding the input line no via a breadth-first search.
- Print (prettily) the slice. (currently it's a GraphViz dot dump.)
Setup:
- Download and build the x64 version of
llvmandclangfor Windows (Visual Studio) @ https://clang.llvm.org/get_started.html usingcmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=X86 -G "Visual Studio 16 2019" -A x64 -Thost=x64 ..\llvm(if 16 doesn't work, try a different constant depending on your version of VS, e.g. 15 or 17). - Launch
LLVM.slngenerated by the command above in VS and build the subgroupClang libraries. - Launch
slicer.slnand open the projectProperties. Scan all compiler and linker options for absolute paths and change them according to your layout, namely the LLVM/Clang build folder path.