This is an archive of the discontinued LLVM Phabricator instance.

[libc][math] Move str method from FPBits class to testing utils.
ClosedPublic

Authored by lntue on Jun 9 2023, 8:53 PM.

Details

Summary

str method of FPBits class is only used for pretty printing its objects
in tests. It brings cpp::string dependency to FPBits class, which is not ideal
for embedded use case. We move str method to a free function in test utils and
remove this dependency of FPBits class.

Diff Detail

Event Timeline

lntue created this revision.Jun 9 2023, 8:53 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 9 2023, 8:53 PM
lntue requested review of this revision.Jun 9 2023, 8:53 PM

LGTM but a comment about putting the new function in a different place.

libc/test/UnitTest/StringUtils.h
22

I am planning to get rid of this also as it is duplicated functionality without tests. Also, adding code here but test in test/src/__support breaks our structuring. Can you move the new str function to say src/__support/FPUtil/fpbits_str.h ?

lntue updated this revision to Diff 530158.Jun 9 2023, 11:08 PM

Move str function to a separate header in src/__support/FPUtil folder.

lntue marked an inline comment as done.Jun 9 2023, 11:08 PM
sivachandra accepted this revision.Jun 9 2023, 11:31 PM
This revision is now accepted and ready to land.Jun 9 2023, 11:31 PM

Tested with my local changes and it's working, thank you!