GaloisInc / MATE

MATE is a suite of tools for interactive program analysis with a focus on hunting for bugs in C and C++ code using Code Property Graphs.
https://galoisinc.github.io/MATE/
BSD 3-Clause "New" or "Revised" License
177 stars 12 forks source link

DWARF nodes: APIs for common type derivations #43

Open langston-barrett opened 2 years ago

langston-barrett commented 2 years ago

Right now, if you have a DWARFType foo and you want to get some of its common derivations (e.g. foo *, const foo *), you need to jump through some hoops:

next(typ for typ in foo.deriving_types if typ.is_pointer)
next(typ for typ in foo.deriving_types if typ.is_const)

This becomes especially annoying when you want multiple levels of derivation. Instead, we should support APIs like these:

# foo -> const foo *
foo.const_of.pointer_of