This is an archive of the discontinued LLVM Phabricator instance.

Extend s{,n}printf custom wrappers to support '*' in the format specifiers
ClosedPublic

Authored by martignlo on Jan 29 2015, 6:36 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

martignlo updated this revision to Diff 18955.Jan 29 2015, 6:36 AM
martignlo retitled this revision from to Extend s{,n}printf custom wrappers to support '*' in the format specifiers.
martignlo updated this object.
martignlo edited the test plan for this revision. (Show Details)
martignlo added a reviewer: pcc.
martignlo set the repository for this revision to rL LLVM.
martignlo added a subscriber: Unknown Object (MLST).
pcc added inline comments.Jan 29 2015, 1:54 PM
lib/dfsan/dfsan_custom.cc
971

I feel a little uncomfortable about introducing more of these macros. Can we perhaps introduce a struct to hold the state used by these functions and make these macros and the functions into methods of the struct?

martignlo updated this revision to Diff 20502.Feb 23 2015, 3:53 AM
martignlo removed rL LLVM as the repository for this revision.
martignlo updated this revision to Diff 20504.Feb 23 2015, 3:59 AM
pcc accepted this revision.Mar 18 2015, 10:04 PM
pcc edited edge metadata.

LGTM with my suggestions.

lib/dfsan/dfsan_custom.cc
1013

If you keep track of the start of the chunk of the format string instead of its size, you will have only one thing to increment here and in the other loop.

1015

You could modify this switch statement to consume characters instead:

switch (*++formatter.fmt) {

Once you make the matching change to build_format_string, this will save you from having to confusingly increment and decrement formatter.fmt above.

This revision is now accepted and ready to land.Mar 18 2015, 10:04 PM
martignlo updated this revision to Diff 23475.Apr 9 2015, 4:41 AM
martignlo edited edge metadata.
martignlo set the repository for this revision to rL LLVM.
This revision was automatically updated to reflect the committed changes.