This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizer] Internal Printf string width + left-justify.
ClosedPublic

Authored by alekseyshl on Apr 20 2018, 3:52 PM.

Details

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.

Event Timeline

alekseyshl created this revision.Apr 20 2018, 3:52 PM
Herald added subscribers: Restricted Project, delcypher, kubamracek. · View Herald TranscriptApr 20 2018, 3:52 PM
eugenis accepted this revision.Apr 20 2018, 4:26 PM
eugenis added inline comments.
lib/sanitizer_common/sanitizer_printf.cc
98–105

the fact that "width" can be negative definitely deserves a comment

This revision is now accepted and ready to land.Apr 20 2018, 4:26 PM
  • Add comment about width semantics
alekseyshl marked an inline comment as done.Apr 23 2018, 12:52 PM
This revision was automatically updated to reflect the committed changes.