3.1.6. Clang Format

The tool is located in tools/waf-tools.

3.1.6.1. Tool Documentation

Implements a waf tool to run clang-format.

Listing 3.12 shows how to use this tool.

Listing 3.12 f_clang-format.py
1def options(opt):
2    opt.load("clang_format")
3
4def configure(conf):
5    conf.load("clang_format")
6
7def build:
8    files = bld.path.ant_glob("\*\*/\*.c")
9    bld(features="clang-format", files=files)
class f_clang_format.clang_format(*args: Any, **kwargs: Any)

Bases: waflib.Task.Task

Task to run clang-format on all given source files

color = 'BLUE'

color in which the command line is displayed in the terminal

Type

str

f_clang_format.configure(conf)

configuration step of the clang-format tool

  • searches for the program clang-format

  • applies configured options

f_clang_format.options(opt)

Passing options to clang-format

f_clang_format.process_clang_format(self)

creates clang-format task for each input source