Reader small image

You're reading from  Clang Compiler Frontend

Product typeBook
Published inMar 2024
PublisherPackt
ISBN-139781837630981
Edition1st Edition
Right arrow
Author (1)
Ivan Murashko
Ivan Murashko
author image
Ivan Murashko

Ivan V. Murashko is a C++ software engineer: He got his PhD from Peter the Great St.Petersburg Polytechnic University and has over 20 years of C++ programming experience; since 2020 he has worked with LLVM compilers. His area of interest includes clang compiler frontend and clang tools (clang-tidy, clangd).
Read more about Ivan Murashko

Right arrow

7.3 Clang-Tidy as a code modification tool

We plan to investigate FixItHint, which is a part of the Clang Diagnostics subsystem (see Section 4.4.2, Diagnostics support). FixItHint can be integrated with clang::Rewriter and clang::tooling::Replacement explored previously, providing advanced diagnostics that are used in powerful tools such as Clang-Tidy.

7.3.1 FixItHint

clang::FixItHint is a class in the Clang compiler that significantly enhances its diagnostic capabilities. Its primary role is to provide automated suggestions for correcting code errors or issues that the compiler detects. These suggestions, known as ”fix-its,” are a part of Clang’s diagnostic messages and are intended to guide developers in resolving identified issues in their code.

When Clang encounters a coding error, warning, or stylistic issue, it generates a FixItHint. This hint contains specific recommendations for changes in the source code. For instance, it may suggest replacing a...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Clang Compiler Frontend
Published in: Mar 2024Publisher: PacktISBN-13: 9781837630981

Author (1)

author image
Ivan Murashko

Ivan V. Murashko is a C++ software engineer: He got his PhD from Peter the Great St.Petersburg Polytechnic University and has over 20 years of C++ programming experience; since 2020 he has worked with LLVM compilers. His area of interest includes clang compiler frontend and clang tools (clang-tidy, clangd).
Read more about Ivan Murashko