[Sanitizer] Internal Printf string width + left-justify.
authorAlex Shlyapnikov <alekseys@google.com>
Mon, 23 Apr 2018 20:30:50 +0000 (20:30 +0000)
committerAlex Shlyapnikov <alekseys@google.com>
Mon, 23 Apr 2018 20:30:50 +0000 (20:30 +0000)
commit88b7be0d13759536945d1270fbed114f530890ae
tree5b34a12640d780b107762897dfab3e23126f3cd7
parentfa8f5ad9f358d98f3e023eed0c1f0d748584cc60
[Sanitizer] Internal Printf string width + left-justify.

Summary:
Example:

  Printf("%-5s", "123");

should yield:

  '123  '

In case Printf's requested string field width is larger than the string
argument length, the resulting string should be padded up to the requested
width.

For the simplicity sake, implementing left-justified (right padding) only.

Reviewers: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D45906

llvm-svn: 330643
compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc