[PATCH] D81667: [RFC, FileCheck] Add precision to format specifier

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 02:41:31 PDT 2020


jhenderson added a comment.

Functionality looks reasonable, although I haven't checked the testing yet.



================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:738
 
+The syntax of ``<fmtspec>`` is: ``.<precision><conversion specifier>`` where:
+
----------------
If we expand this out, the full syntax is apparently `[[#%.<precision><precision><conversion specifier>,<NUMVAR:]]`, which I don't think is what you mean :-)


================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:742-743
+ ``<precision>`` indicates the minimum number of digits that the value matched
+ must have, expecting leading zeros should the value be too small to have that
+ many digits.
+
----------------
Should we say something about leading zeros beyond those required by the precision value?


================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:746
+*  ``<conversion specifier>`` is an optional scanf-style conversion specifier
+  to  indicate what number format to match (e.g. hex number).  Currently
+  accepted format specifiers are ``%u``, ``%d``, ``%x`` and ``%X``.  If absent,
----------------
Nit: There's a double space after "to".


================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:765
+  in this context indicating how a numeric expression value should be matched
+  against. If absent, both component of the format specifier are inferred from
+  the matching format of the numeric variable(s) used by the expression
----------------



================
Comment at: llvm/lib/Support/FileCheck.cpp:49
+  if (Precision) {
+    const char *RegexPrefix;
+
----------------
`StringRef`?


================
Comment at: llvm/lib/Support/FileCheck.cpp:796
+      // class instance representing this expression.
+      SMLoc fmtloc = SMLoc::getFromPointer(FormatExpr.data());
+      switch (popFront(FormatExpr)) {
----------------
Can you fix the case of `fmtloc` whilst you're modifying this line, please?


================
Comment at: llvm/lib/Support/FileCheckImpl.h:86
+  /// \returns a wildcard regular expression string that matches any value in
+  /// the format represented by this instance and none other value, or an error
+  /// if the format is NoFormat.
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81667/new/

https://reviews.llvm.org/D81667



More information about the llvm-commits mailing list