[llvm] r185766 - COFFDumper: Print uint64_t with the right format string.
David Blaikie
dblaikie at gmail.com
Sat Jul 6 16:40:50 PDT 2013
On Sat, Jul 6, 2013 at 1:01 PM, Benjamin Kramer
<benny.kra at googlemail.com> wrote:
> Author: d0k
> Date: Sat Jul 6 15:01:46 2013
> New Revision: 185766
>
> URL: http://llvm.org/viewvc/llvm-project?rev=185766&view=rev
> Log:
> COFFDumper: Print uint64_t with the right format string.
>
> I wish we could typecheck llvm::format.
Just rambling, but could it be done with constexpr & template magic? I
thought that was one of the ideas that constexpr/variadic templates
might allow (I suppose the easy way is for the format strings not to
specify types at all & just use variadic templates to get the argument
types, which doesn't help if we need to work in C++98 too - but I was
thinking some kind of user defined type with sfinae'd typedefs based
on constexprs of the format string to extract the parameter types,
etc)
Or can we not just annotate format with the printf formatter
attributes? Or does it use some custom format specification?
>
> Modified:
> llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
>
> Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=185766&r1=185765&r2=185766&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
> +++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Sat Jul 6 15:01:46 2013
> @@ -479,15 +479,15 @@ static std::string formatSymbol(const st
>
> StringRef Sym;
> if (resolveSymbolName(Rels, Offset, Sym)) {
> - Str << format(" (0x%X)", Offset);
> + Str << format(" (0x%" PRIX64 ")", Offset);
> return Str.str();
> }
>
> Str << Sym;
> if (Disp > 0) {
> - Str << format(" +0x%X (0x%X)", Disp, Offset);
> + Str << format(" +0x%X (0x%" PRIX64 ")", Disp, Offset);
> } else {
> - Str << format(" (0x%X)", Offset);
> + Str << format(" (0x%" PRIX64 ")", Offset);
> }
>
> return Str.str();
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list