This is an archive of the discontinued LLVM Phabricator instance.

Refactor wasm/WriterUtil.{cpp,h}.
ClosedPublic

Authored by ruiu on Feb 16 2018, 12:19 PM.

Details

Summary
  • Makes code more in line with LLVM style (e.g. const char * -> StringRef)
  • Do not use formatv since we can construct message just by +
  • Replace some odd types such as const StringRef with more common type
  • Do not use default arguments if they are not necessary

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Feb 16 2018, 12:19 PM
ruiu updated this revision to Diff 134686.Feb 16 2018, 12:24 PM
  • removed if (!Msg.empty()) check. When we use these functions, we should always print out debug message.
sbc100 accepted this revision.Feb 16 2018, 12:34 PM

Thanks!

lld/wasm/WriterUtils.cpp
83 ↗(On Diff #134686)

I sometimes find the format string more readable than lots of small strings fragments +'d together. But I don't feel strongly enough about to to break local convention.

This revision is now accepted and ready to land.Feb 16 2018, 12:34 PM
ruiu added a comment.Feb 16 2018, 12:39 PM

I sometimes find the format string more readable than lots of small strings fragments +'d together. But I don't feel strongly enough about to to break local convention.

Not everybody memorizes this Python-style format string, and lld doesn't have a lot of code that needs formatting strings (so even if there's something better, investing in it isn't worth the cost), so we generally avoid using that in lld.

This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.