Extra Clang Tools 8.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 8.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.

What’s New in Extra Clang Tools 8.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

  • clangd now adds namespace qualifiers in code completion, for example, if you type “vec”, the list of completions will include “std::vector”.

    See also: r343248.

  • When a global index is available, clangd will use it to augment the results of “go to definition” and “find references” queries. Global index also enables global code completion, which suggests symbols that are not imported in the current file and automatically inserts the missing #include directives.

  • clangd stores the symbol index on disk in a new compact binary serialization format. It is 10x more compact than YAML and 40% more compact than gzipped YAML.

    See also: r341375.

  • clangd has a new efficient symbol index suitable for complex and fuzzy queries and large code bases (e.g., LLVM, Chromium). This index is used for code completion, go to definition, and cross-references. The architecture of the index allows for complex and fuzzy retrieval criteria and sophisticated scoring.

    See also: discussion on the mailing list, design doc.

  • clangd has a new LSP extension that communicates information about activity on clangd’s per-file worker thread. This information can be displayed to users to let them know that the language server is busy with something. For example, in clangd, building the AST blocks many other operations.

    More info: File status.

  • clangd has a new LSP extension that allows the client to supply the compilation commands over LSP, instead of finding compile_commands.json on disk.

    More info: Compilation commands.

  • clangd has a new LSP extension that allows the client to request fixes to be sent together with diagnostics, instead of asynchronously.

    More info: Inline fixes for diagnostics.

  • clangd has a new LSP extension that allows the client to resolve a symbol in a light-weight manner, without retrieving further information (like definition location, which may require consulting an index).

    More info: Symbol info request.

Improvements to clang-query

  • A new command line parameter --preload was added to run commands from a file and then start the interactive interpreter.

  • The command q can was added as an alias for quit to exit the clang-query interpreter.

  • It is now possible to bind to named values (the result of let expressions). For example:

    let fn functionDecl()
    match fn.bind("foo")
    
  • It is now possible to write comments in clang-query code. This is primarily useful when using script-mode. Comments are all content following the # character on a line:

    # This is a comment
    match fn.bind("foo") # This is a trailing comment
    
  • The new set print-matcher true command now causes clang-query to print the evaluated matcher together with the resulting bindings.

  • A new output mode detailed-ast was added to clang-query. The existing dump output mode is now a deprecated alias for detailed-ast

  • Output modes can now be enabled or disabled non-exclusively. For example,

    # Enable detailed-ast without disabling other output, such as diag
    enable output detailed-ast
    m functionDecl()
    
    # Disable detailed-ast only
    disable output detailed-ast
    m functionDecl()
    

Improvements to clang-tidy