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

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 17 10:45:56 PDT 2020


jdenny added a comment.

>> I don't understand the above regex due to the space character after the `?`.  Was that intended?
> 
> No, fixed now.

It now says `#%.5u, VAR2:` matches `(([1-9][0-9]+)?[0-9]{1,5})`, but that matches `123456789`.  I think that's unintended.

>> Can you give some example inputs and explain the intended matching behavior for `#%.5u, VAR2:`?  Why is this behavior needed in FileCheck but not in scanf?
> 
> Say the directive is:
> 
> CHECK: Address #%.8x,ADDR: is aligned
> 
> and the input text is:
> 
> Address 12345678 is aligned
> 
> I'd expect the directive to match and the value in ADDR to be 0x12345678. Now if the input text was:
> 
> Address FFFFFFFF12345678
> 
> I'd expect the directive to fail.

You mean fail to match and continue searching?  Or fail immediately?

So, `%.8x` is a maximum?  For printf, it's a minimum.  scanf's `%8x` (no `.`) feels more like what you're going for except that it discards additional digits instead of failing to match.


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