Automatic Array Property Detection Via Static Analysis
Simultaneous use of multiple programming languages assists in creating efficient, coherent modern programs in the face of legacy code; however, creating language bindings to low-level languages like C by hand is tedious and error prone. We offer some relief in the form of an automated suite of analyses, designed to enhance the quality of automatically produced bindings by recovering high-level array type information missing in C’s type system. We emit annotations in the style of GObjectIntrospection, which produces bindings from annotations. We annotate an array argument as terminated by a special sentinel value, fixed length of a constant size, or of length determined by another argument. Each of these properties helps produce more idiomatic, efficient bindings.