Modernizing C++ applications with template-based transformations

Printer-friendly version
Info
Prerequisites: 
  • An interest in programming languages, compilers and reasoning about programs
Context: 

Many companies rely on the C++ language as their daily driver. Since the C++11 standard was introduced, the language has been extended with a host of new features and constructs: lambda functions, rvalue references, move constructors, explicit overriding, strongly-typed null constants, template aliases, type inference, foreach loops, smart pointers, and many more.

To take advantage of all these new features in existing (C++03) code, this requires a substantial amount of refactoring, especially for a large code base. To perform this refactoring by hand would be a very tedious and error-prone process. To speed up the process, and to avoid accidental errors, we believe a suitable program transformation tool can prove quite useful here.

Goal & Research Activities: 

The goal of this thesis is to build a prototype of a program search and transformation tool for C++. One of the companies within the Cha-Q research project, OM Partners, has expressed interest in such a tool to migrate their code to C++11, so a close collaboration with them is possible to evaluate the tool in practice.

The transformations specified for this prototype should be in the same vein as those of the Ekeko/X program search and transformation tool for Java. Ekeko/X, developed here at the Software Languages Lab, is a template-based tool, which means that searches and transformations are specified in terms of source code templates. In turn, a source code template is a code snippet where parts of the snippet can be replaced by wildcards or variables, or they can be annotated with various constraints.
While Java and C++ are both object-oriented languages, they are quite different when taking a closer look, so the prototype for C++ can be built from the ground up. One important decision to take here is which platform to use as a starting point, as several C++ compilers exist. (e.g. LLVM, GCC, CDT) Finally, the references section below includes a few papers that can be used as inspiration for the types of C++11 refactorings we would like to express.