Extra Clang Tools 14.0.0 Release Notes

Written by the LLVM Team

Introduction

This document contains the release notes for the Extra Clang Tools, part of the Clang release 14.0.0. Here we describe the status of the Extra Clang Tools in some detail, including major improvements from the previous release and new feature work. All LLVM releases may be downloaded from the LLVM releases web site.

For more information about Clang or LLVM, including information about the latest release, please see the Clang Web Site or the LLVM Web Site.

Note that if you are reading this file from a Git checkout or the main Clang web page, this document applies to the next release, not the current one. To see the release notes for a specific release, please see the releases page.

What’s New in Extra Clang Tools 14.0.0?

Some of the major new features and improvements to Extra Clang Tools are listed here. Generic improvements to Extra Clang Tools as a whole or to its underlying infrastructure are described first, followed by tool-specific sections.

Improvements to clangd

Inlay hints

  • This feature provides texutal hints interleaved with the code, like parameter names, deduced types and designated initializers.

  • The clangd/inlayHints LSP extension is now documented, and both position and range.

  • Inlay hints are now on-by-default in clangd, if the client supports and exposes them. (vscode-clangd does so). The -inlay-hints flag has been removed.

  • Inlay hints can be disabled or configured in the config file.

Diagnostics

  • Unused #include diagnostics are available. These are off by default, and can be turned on through the Diagnostics.UnusedIncludes config option.

  • Deprecated and Unnecessary tags from LSP 3.15 are set on -Wdeprecated and -Wunused diagnostics. Clients may display these in a specialized way.

  • clangd suggests inserting includes to fix problems in more cases:

    • calling unknown functions in C, even when an implicit declaration is inferred.

    • incomplete types (some additional cases).

    • various diagnostics that specify “include <foo.h>” in their text.

  • The “populate switch” action is more reliably offered as a fix for -Wswitch warnings, and works with C enums.

  • Warnings specified by ExtraArgs: -W... flags in .clang-tidy config files are now produced.

Semantic Highlighting

  • virtual modifier for method names

  • usedAsMutableReference modifier for function parameters

  • Lambda captures now marked as local variables.

Compile flags

  • Compile flags like -xc++-header that must precede input file names are now added correctly by the CompileFlags.Add config option.

  • If multiple architectures are specified (e.g. when targeting Apple M1+Intel), clangd will now use the host architecture instead of failing to parse.

  • Added CompileFlags.Compiler option to override executable name in compile flags.

  • Copying compile_commands.json entries from one file to another (and simply adjusting file) should now work correctly.

Hover

  • Hovering on many attributes (e.g. [[nodiscard]]) will show documentation.

  • Hovering on include directives shows the resolved header path.

  • Hovering on character literals shows their numeric value.

  • Code snippets are marked with the appropriate language instead of always C++. This may improve clients’ syntax highlighting.

  • Include desugared types in hover, like in diagnostics. Off by default, controlled with Hover.ShowAKA config option.

Code completion

  • Completion of attributes (e.g. [[gsl::Owner(Foo)]])

  • Completion of /*ParameterName=*/ comments.

  • Documentation of items with annotate attributes now includes the annotation.

  • Improved handling of results with 1-3 character names.

  • Completion of members in constructor init lists (Foo() : member_() {}) is much more reliable.

  • C++ Standard library completions should be less noisy: parameter names are deuglified (vector<_Tp> is now vector<Tp>) and many __implementation_details are hidden altogether.

Signature help

  • Signatures for template argument lists

  • Signatures for braced constructor calls

  • Signatures for aggregate initializers

  • Signatures for members in constructor init lists are much more reliable.

  • Variadic functions correctly show signature help when typing the variadic arguments.

  • Signature help is retriggered on closing brackets ), }, >. This means signature help should be correct after nested function calls.

Cross-references

  • Support for textDocument/typeDefinition LSP request.

  • Improved handling of symbols introduced via using declarations.

  • Searching for references to an overriding method also returns references to the base class method. (Typically calls that may invoke the override).

  • All references from the current file are always returned, even if there are enough to exceed our usual limit.

Objective-C

  • #pragma mark directives now form groups in the document outline.

  • id and instancetype are treated as keywords rather than typedefs

Miscellaneous

  • Include request context on crashes when possible.

  • Many stability, performance and correctness improvements.

  • -use-dirty-headers command line flag to use dirty buffer contents when parsing headers, rather than the saved on-disk contents.

  • clangd --check=/path/to/file.cpp now reads config files in ancestor directories, in addition to user config file.

  • Improved compile flags handling in clangd-indexer.

  • The index file format changed in this release, indexes need to be rebuilt. This should happen transparently in standard cases (the background index).

Improvements to clang-doc

The improvements are…

Improvements to clang-query

The improvements are…

Improvements to clang-rename

The improvements are…

Improvements to clang-tidy

  • Ignore warnings from macros defined in system headers, if not using the -system-headers flag.

  • Added support for globbing in NOLINT* expressions, to simplify suppressing multiple warnings in the same line.

  • Added support for NOLINTBEGINNOLINTEND comments to suppress Clang-Tidy warnings over multiple lines.

  • Added support for external plugin checks with -load.

New checks

Changes in existing checks

Improvements to include-fixer

The improvements are…

Improvements to clang-include-fixer

The improvements are…

Improvements to modularize

The improvements are…

Improvements to pp-trace

The improvements are…