Fraunhofer-AISEC / cpg

A library to extract Code Property Graphs from C/C++, Java, Go, Python, Ruby and every other language through LLVM-IR.
https://fraunhofer-aisec.github.io/cpg/
Apache License 2.0
248 stars 60 forks source link

Redesign of (C++) template handling #1492

Open oxisto opened 2 months ago

oxisto commented 2 months ago

We have arrived at a point where we want to parse real-world applications in C++ and most of them use some kind of template code. Unfortunately, our template handling code is bug ridden and not implemented completely (e.g., the proposed expansion pass is missing). This issue will serve as the central point in discussing how a redesign of the template handling should look like.

I will update this issue as things progress.

Design Goals

Prep Work

The main prep tasks we should do before any of this is to remove the CXXCallResolverHelper.kt file which contains a lot of alleged C++ specific code, as well as all of the template code. We should merge in some of the alleged C++ specific code, which mostly deals with default parameters and implicit type conversions in with the main symbol resolver and use type traits to deal with some specifics. The template code will most likely be somewhat specific to C++, but regardless we should move all of it to a place that is accessible for all languages that implement HasTemplates.

### Tasks
- [ ] Merge in custom C++ call resolver with the main `SymbolResolver`