llvm.org GIT mirror llvm / 41a9649
Add more PRI.64 macros for MSVC and use them throughout the codebase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143799 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 7 years ago
12 changed file(s) with 54 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
166166 # define UINT64_C(C) C##ui64
167167 #endif
168168
169 #ifndef PRId64
170 # define PRId64 "I64d"
171 #endif
172 #ifndef PRIi64
173 # define PRIu64 "I64i"
174 #endif
175 #ifndef PRIo64
176 # define PRIx64 "I64o"
177 #endif
178 #ifndef PRIu64
179 # define PRIu64 "I64u"
180 #endif
169181 #ifndef PRIx64
170182 # define PRIx64 "I64x"
183 #endif
184 #ifndef PRIX64
185 # define PRIX64 "I64X"
171186 #endif
172187
173188 #endif /* _MSC_VER */
166166 # define UINT64_C(C) C##ui64
167167 #endif
168168
169 #ifndef PRId64
170 # define PRId64 "I64d"
171 #endif
172 #ifndef PRIi64
173 # define PRIu64 "I64i"
174 #endif
175 #ifndef PRIo64
176 # define PRIx64 "I64o"
177 #endif
178 #ifndef PRIu64
179 # define PRIu64 "I64u"
180 #endif
169181 #ifndef PRIx64
170182 # define PRIx64 "I64x"
183 #endif
184 #ifndef PRIX64
185 # define PRIX64 "I64X"
171186 #endif
172187
173188 #endif /* _MSC_VER */
17581758 case 4:
17591759 case 8:
17601760 if (AP.isVerbose())
1761 AP.OutStreamer.GetCommentOS() << format("0x%llx\n", CI->getZExtValue());
1761 AP.OutStreamer.GetCommentOS() << format("0x%" PRIx64 "\n",
1762 CI->getZExtValue());
17621763 AP.OutStreamer.EmitIntValue(CI->getZExtValue(), Size, AddrSpace);
17631764 return;
17641765 default:
229229
230230 #ifndef NDEBUG
231231 void DIEInteger::print(raw_ostream &O) {
232 O << "Int: " << (int64_t)Integer
233 << format(" 0x%llx", (unsigned long long)Integer);
232 O << "Int: " << (int64_t)Integer << " 0x";
233 O.write_hex(Integer);
234234 }
235235 #endif
236236
121121 const uint32_t hex_width = Header.AddrSize * 2;
122122 for (DescriptorConstIter pos = ArangeDescriptors.begin(),
123123 end = ArangeDescriptors.end(); pos != end; ++pos)
124 OS << format("[0x%*.*llx -", hex_width, hex_width, pos->Address)
125 << format(" 0x%*.*llx)\n", hex_width, hex_width, pos->getEndAddress());
124 OS << format("[0x%*.*" PRIx64 " -", hex_width, hex_width, pos->Address)
125 << format(" 0x%*.*" PRIx64 ")\n",
126 hex_width, hex_width, pos->getEndAddress());
126127 }
127128
128129
9999 const uint32_t num_ranges = getNumRanges();
100100 for (uint32_t i = 0; i < num_ranges; ++i) {
101101 const Range &range = Aranges[i];
102 OS << format("0x%8.8x: [0x%8.8llx - 0x%8.8llx)\n", range.Offset,
103 (uint64_t)range.LoPC, (uint64_t)range.HiPC());
102 OS << format("0x%8.8x: [0x%8.8" PRIx64 " - 0x%8.8" PRIx64 ")\n",
103 range.Offset, (uint64_t)range.LoPC, (uint64_t)range.HiPC());
104104 }
105105 }
106106
107107 void DWARFDebugAranges::Range::dump(raw_ostream &OS) const {
108 OS << format("{0x%8.8x}: [0x%8.8llx - 0x%8.8llx)\n", Offset, LoPC, HiPC());
108 OS << format("{0x%8.8x}: [0x%8.8" PRIx64 " - 0x%8.8" PRIx64 ")\n",
109 Offset, LoPC, HiPC());
109110 }
110111
111112 void DWARFDebugAranges::appendRange(uint32_t offset, uint64_t low_pc,
6767 }
6868
6969 void DWARFDebugLine::Row::dump(raw_ostream &OS) const {
70 OS << format("0x%16.16llx %6u %6u", Address, Line, Column)
70 OS << format("0x%16.16" PRIx64 " %6u %6u", Address, Line, Column)
7171 << format(" %6u %3u ", File, Isa)
7272 << (IsStmt ? " is_stmt" : "")
7373 << (BasicBlock ? " basic_block" : "")
279279 case DW_FORM_block4:
280280 if (uvalue > 0) {
281281 switch (Form) {
282 case DW_FORM_block: OS << format("<0x%llx> ", uvalue); break;
282 case DW_FORM_block: OS << format("<0x%" PRIx64 "> ", uvalue); break;
283283 case DW_FORM_block1: OS << format("<0x%2.2x> ", (uint8_t)uvalue); break;
284284 case DW_FORM_block2: OS << format("<0x%4.4x> ", (uint16_t)uvalue); break;
285285 case DW_FORM_block4: OS << format("<0x%8.8x> ", (uint32_t)uvalue); break;
329329 break;
330330 case DW_FORM_ref8:
331331 cu_relative_offset = true;
332 OS << format("cu + 0x%8.8llx", uvalue);
332 OS << format("cu + 0x%8.8" PRIx64, uvalue);
333333 break;
334334 case DW_FORM_ref_udata:
335335 cu_relative_offset = true;
336 OS << format("cu + 0x%llx", uvalue);
336 OS << format("cu + 0x%" PRIx64, uvalue);
337337 break;
338338
339339 // All DW_FORM_indirect attributes should be resolved prior to calling
183183 OS << " ";
184184
185185 if (Total.getMemUsed())
186 OS << format("%9lld ", (long long)getMemUsed());
186 OS << format("%9" PRId64 " ", (int64_t)getMemUsed());
187187 }
188188
189189
9696 O << '$' << (int64_t)Op.getImm();
9797
9898 if (CommentStream && (Op.getImm() > 255 || Op.getImm() < -256))
99 *CommentStream << format("imm = 0x%llX\n", (long long)Op.getImm());
99 *CommentStream << format("imm = 0x%" PRIX64 "\n", (uint64_t)Op.getImm());
100100
101101 } else {
102102 assert(Op.isExpr() && "unknown operand kind in printOperand");
458458 DebugOut, nulls())) {
459459 uint64_t SectAddress = 0;
460460 Sections[SectIdx].getAddress(SectAddress);
461 outs() << format("%8llx:\t", SectAddress + Index);
461 outs() << format("%8" PRIx64 ":\t", SectAddress + Index);
462462
463463 DumpBytes(StringRef(Bytes.data() + Index, Size));
464464 IP->printInst(&Inst, outs(), "");
578578 outs() << FunctionMap[SectAddress + Inst.Address]-> getName()
579579 << ":\n";
580580
581 outs() << format("%8llx:\t", SectAddress + Inst.Address);
581 outs() << format("%8" PRIx64 ":\t", SectAddress + Inst.Address);
582582 DumpBytes(StringRef(Bytes.data() + Inst.Address, Inst.Size));
583583
584584 if (fi->second.contains(fi->first)) // Indent simple loops.
9595 const char *radix_fmt = 0;
9696 switch (Radix) {
9797 case octal:
98 radix_fmt = "llo";
98 radix_fmt = PRIo64;
9999 break;
100100 case decimal:
101 radix_fmt = "llu";
101 radix_fmt = PRIu64;
102102 break;
103103 case hexadecimal:
104 radix_fmt = "llx";
104 radix_fmt = PRIx64;
105105 break;
106106 }
107107 if (OutputFormat == sysv) {
222222 total_data,
223223 total_bss);
224224 fmtbuf.clear();
225 fmt << "%7" << (Radix == octal ? "llo" : "llu") << " "
226 << "%7llx ";
225 fmt << "%7" << (Radix == octal ? PRIo64 : PRIu64) << " "
226 << "%7" PRIx64 " ";
227227 outs() << format(fmt.str().c_str(),
228228 total,
229229 total);