[PATCH] D40407: [COFF] Implement constructor priorities
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 27 14:29:41 PST 2017
mstorsjo added inline comments.
================
Comment at: lib/CodeGen/TargetLoweringObjectFileImpl.cpp:1233
+ Number << '.' << std::setw(5) << std::setfill('0') << (65535 - Priority);
+ Name += Number.str();
+ }
----------------
ruiu wrote:
> mstorsjo wrote:
> > Do you have any suggestion on a more idiomatic way of doing the equivalent of `snprintf("%05u", 65535 - Priority)` here? This feels quite roundabout.
> I think `snprintf` isn't actually bad. Alternatively, you could include `llvm/Support/Format.h` and do
>
> Number << format("%05u", 65535 - Priority);
>
> . Or you could keep the current code. I don't have a strong preference.
I did find `llvm/Support/Format.h`, but that doesn't work with the `<<` operator directly to a `std::string`. After yet some more grepping around the source base, I found `raw_string_ostream`, which together with `format()` probably is the best match of how I want to write it.
https://reviews.llvm.org/D40407
More information about the llvm-commits
mailing list