7

Refactoring Tools

Clang is renowned for its ability to provide suggestions for code fixes. For instance, if you miss a semicolon, Clang will suggest that you insert it. The ability to modify source code goes beyond the compilation process and is widely used in various tools for code modifications, particularly in refactoring tools. The ability to offer fixes is a powerful feature that extends the capabilities of a linter framework, such as Clang-Tidy, which not only detects issues but also provides suggestions for fixing them.

In this chapter, we will explore refactoring tools. We will begin by discussing the fundamental classes used for code modification, notably clang::Rewriter. We will use Rewriter to build a custom refactoring tool that ...

Get Clang Compiler Frontend now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.