Description
The Clang compiler is part of the LLVM compiler infrastructure and supports various languages such as C, C++, ObjC and ObjC++. The design of LLVM and Clang enables them to be used as libraries, and has led to the creation of an entire compiler-assisted ecosystem of tools. The relatively friendly codebase of Clang and advancements in the JIT infrastructure in LLVM further enable research into different methods for processing C++ by blurring the boundary between compile time and runtime. Challenges include incremental compilation and fitting compile/link time optimizations into a more dynamic environment.
Incremental compilation pipelines process code chunk-by-chunk by building an ever-growing translation unit. Code is then lowered into the LLVM IR and subsequently run by the LLVM JIT. Such a pipeline allows creation of efficient interpreters. The interpreter enables interactive exploration and makes the C++ language more user friendly. The incremental compilation mode is used by the interactive C++ interpreter, Cling, initially developed to enable interactive high-energy physics analysis in a C++ environment.
Our group puts efforts to incorporate and possibly redesign parts of Cling in Clang mainline through a new tool, clang-repl. The project aims at the design and implementation of robust autocompletion when users type C++ at the prompt of clang-repl. For example:
[clang-repl] class MyLongClassName {};
[clang-repl] My<tab>
// list of suggestions.
Expected results
There are several foreseen tasks:
- Research the current approaches for autocompletion in clang such as
clang -code-completion-at=file:col1:col2
. - Implement a version of the autocompletion support using the partial
translation unit infrastructure in clang’slibInterpreter
. - Investigate the requirements for semantic autocompletion which takes into
account the exact grammar position and semantics of the code. Eg:
[clang-repl] struct S {S* operator+(S&) { return nullptr;}};
[clang-repl] S a, b;
[clang-repl] v = a + <tab> // shows b as the only acceptable choice here.
- Present the work at the relevant meetings and conferences
Desirable skills
Intermediate C++; Understanding of Clang and the Clang API in particular
Project type
Large