Clang - Get Involved

# Open Clang Projects

Here are a few tasks that are available for newcomers to work on, depending on what your interests are. This list is provided to generate ideas, it is not intended to be comprehensive. Please ask on cfe-dev for more specifics or to verify that one of these isn't already completed. :)

- Undefined behavior checking: Improve and extend the runtime checks for undefined behavior which CodeGen inserts for the various `-fsanitize=` modes. A lot of issues can already be caught, but there is more to do here.
- Improve target support: The current target interfaces are heavily stubbed out and need to be implemented fully. See the FIXME's in TargetInfo. Additionally, the actual target implementations (instances of TargetInfoImpl) also need to be completed.
- Implement an tool to generate code documentation: Clang's library-based design allows it to be used by a variety of tools that reason about source code. One great application of Clang would be to build an auto-documentation system like doxygen that generates code documentation from source code. The advantage of using Clang for such a tool is that the tool would use the same preprocessor/parser/ASTs as the compiler itself, giving it a very rich understanding of the code. Clang is already able to read and understand doxygen markup, but cannot yet generate documentation from it.
- Use clang libraries to implement better versions of existing tools: Clang is built as a set of libraries, which means that it is possible to implement capabilities similar to other source language tools, improving them in various ways. Three examples are distcc, the delta testcase reduction tool, and the "indent" source reformatting tool. distcc can be improved to scale better and be more efficient. Delta could be faster and more efficient at reducing C-family programs if built on the clang preprocessor. The clang-based indent replacement, clang-format, could be taught to handle simple structural rules like those in the LLVM coding standards.
- Use clang libraries to extend Ragel with a JIT: Ragel is a state machine compiler that lets you embed C code into state machines and generate C code. It would be relatively easy to turn this into a JIT compiler using LLVM.
- Self-testing using clang: There are several neat ways to improve the quality of clang by self-testing. Some examples:
  - Improve the reliability of AST printing and serialization by ensuring that the AST produced by clang on an input doesn't change when it is reparsed or unserialized.
  - Improve parser reliability and error generation by automatically or randomly changing the input checking that clang doesn't crash and that it doesn't generate excessive errors for small input changes. Manipulating the input at both the text and token levels is likely to produce interesting test cases.
- Continue work on C++1y support: C++98 and C++11 are feature-complete, but there are still several C++1y features to implement. Please see the C++ status report page to find out what is missing.
- StringRef'ize APIs: A thankless but incredibly useful project is StringRef'izing (converting to use `llvm::StringRef` instead of `const char *` or `std::string`) various clang interfaces. This generally simplifies the code and makes it more efficient.
- Universal Driver: Clang is inherently a cross compiler. We would like to define a new model for cross compilation which provides a great user experience -- it should be easy to cross compile applications, install support for new architectures, access different compilers and tools, and be consistent across different platforms. See the Universal Driver web page for more information.
- XML Representation of ASTs: Clang maintains a rich Abstract Syntax Tree that describes the program. Clang could emit an XML document that describes the program, which others tools could consume rather than being tied directly to the Clang binary.The XML representation needs to meet several requirements:
  - General, so that it's able to represent C/C++/Objective-C abstractly, and isn't tied to the specific internal ASTs that Clang uses.
  - Documented, with appropriate Schema against which the output of Clang's XML formatter can be verified.
  - Stable across Clang versions.
- Configuration Manager: Clang/LLVM works on a large number of architectures and operating systems and can cross-compile to a similarly large number of configurations, but the pitfalls of chosing the command-line options, making sure the right sub-architecture is chosen and that the correct optional elements of your particular system can be a pain.

  A tool that would investigate hosts and targets, and store the configuration in files that can later be used by Clang itself to avoid command-line options, especially the ones regarding which target options to use, would greatle alleviate this problem. A simple tool, with little or no dependency on LLVM itself, that will investigate a target architecture by probing hardware, software, libraries and compiling and executing code to identify all properties that would be relevant to command-line options (VFP, SSE, NEON, ARM vs. Thumb etc), triple settings etc.

  The first stage is to build a CFLAGS for Clang that would produce code on the current Host to the identified Target.

  The second stage would be to produce a configuration file (that can be used independently of the Host) so that Clang can read it and not need a gazillion of command-line options. Such file should be simple JSON / INI or anything that a text editor could change.

If you hit a bug with clang, it is very useful for us if you reduce the code that demonstrates the problem down to something small. There are many ways to do this; ask on cfe-dev for advice.