This is an archive of the discontinued LLVM Phabricator instance.

[libc] add mock arg list
ClosedPublic

Authored by michaelrj on Feb 15 2023, 4:08 PM.

Details

Summary

For testing purposes we need to be able to mock out the ArgList class.
This patch adds a mock version of that class as well as a flag to enable
it.

Diff Detail

Event Timeline

michaelrj created this revision.Feb 15 2023, 4:08 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 15 2023, 4:08 PM
sivachandra added inline comments.Feb 15 2023, 9:43 PM
libc/src/__support/arg_list.h
36

Add a comment explaining under what contexts this is useful.

42

Remove the argname vlist here, then you shouldn't need the copy to suppress unused parameter warnings.

60

Since we don't care about the return value, this can be just T().

66

I think this can be improved to make it cleaner but to keep the scope of this change small, let us just do one more thing here: Move this to parser.h so that only the class Parser has to worry about it.

libc/src/stdio/fprintf.cpp
24 ↗(On Diff #497836)

Why should this and others outside of the class Parser change?

michaelrj marked 4 inline comments as done.

narrow the scope of the ArgProvider switch

michaelrj added inline comments.Feb 16 2023, 1:31 PM
libc/src/__support/arg_list.h
60

We don't care right now, but in the future I plan to use the return values to help distinguish between blocks when fuzzing the printf parser.

sivachandra accepted this revision.Feb 16 2023, 10:37 PM
This revision is now accepted and ready to land.Feb 16 2023, 10:37 PM
michaelrj marked an inline comment as done.Feb 17 2023, 11:09 AM
This revision was landed with ongoing or failed builds.Feb 17 2023, 11:18 AM
This revision was automatically updated to reflect the committed changes.