[FileCheck] Add precision to format specifier
authorThomas Preud'homme <thomasp@graphcore.ai>
Thu, 11 Jun 2020 15:14:24 +0000 (16:14 +0100)
committerThomas Preud'homme <thomasp@graphcore.ai>
Sun, 30 Aug 2020 18:40:57 +0000 (19:40 +0100)
commit998709b7d553e89c4ff89725d3fa646468b7b437
tree04ae8358db75a41d1526fde25c0b8afdb7491d3c
parent719548d63d9f906b3b0e0e7d7681a9bfa1d3d8cf
[FileCheck] Add precision to format specifier

Add printf-style precision specifier to pad numbers to a given number of
digits when matching them if the value is smaller than the given
precision. This works on both empty numeric expression (e.g. variable
definition from input) and when matching a numeric expression. The
syntax is as follows:

[[#%.<precision><format specifier>, ...]

where <format specifier> is optional and ... can be a variable
definition or not with an empty expression or not. In the absence of a
precision specifier, a variable definition will accept leading zeros.

Reviewed By: jhenderson, grimar

Differential Revision: https://reviews.llvm.org/D81667
llvm/docs/CommandGuide/FileCheck.rst
llvm/lib/Support/FileCheck.cpp
llvm/lib/Support/FileCheckImpl.h
llvm/test/FileCheck/numeric-expression.txt
llvm/unittests/Support/FileCheckTest.cpp