Compiler infrastructure: LLVM 16 makes the switch to C++17

The LLVM compiler infrastructure, version 16, was released punctually within the framework of the regular half-yearly cycle. As of the current release, the Clang compiler uses C++17 by default, but is also expanding the implementation of newer standards – especially C++20. Additions and updates in LLVM 16 can also be found in the backends, especially for ARM, LoongArch and RISC-V.

As already announced when LLVM 15 was released, C++17 (gnu++17) marks the standard for the programming languages ​​C++ and ObjC++ from the new release. Along with these and other innovations in Clang 16, developers have to consider some potential breaking changes when updating to the new compiler. To avoid any incompatibilities, projects that use configuration scripts, for example, should ensure that the results before or after setting -Werror=implicit-function-declarations or -Wimplicit-int Don’t change them, because their warnings now default to an error in C99, C11, and C17.

For the first time, Clang also allows loading multiple configuration files. Files from the standard configuration directories are loaded first – unless the --no-default-configoption is set. All other files that are explicitly marked with the now reusable compiler flag --config= provided will be loaded afterwards.

With a view to the numerous backends, LLVM 16 provides updates for ARM, LoongArch and RISC-V, among others. While the architectures ARMv9-A, ARMv9.1-A and ARMv9.2 were newly added in the last major release, the targets ARMv2, ARMv2A, ARMv3 and ARMv3M are now omitted because, according to the official justification, LLVM has probably never been able to to generate correct code for these architecture versions. LoongArch is no longer considered an experimental target and therefore no longer needs to be explicitly built with the command LLVM_EXPERIMENTAL_TARGETS_TO_BUILD to be activated. A new user guide is also available for RISC-V, which provides a detailed overview of the use of the backend and the RISC-V command sets supported by LLVM.

An internal change concerns the LLVM intermediate code (Intermediate Representation, IR). The function attributes readnone, readonly, writeonly, argmemonly, inaccessiblememonly and inaccessiblemem_or_argmemonly have been merged and replaced with a single attribute: memory(...). A mapping from the old to the new attribute is now possible according to the following example: inaccessiblemem_or_argmemonly -> memory(argmem: readwrite, inaccessiblemem: readwrite).

A detailed overview of all innovations and changes can be found in the respective release notes for Clang 16 and LLVM 16.


To home page

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *