aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Support/DataTypes.h.cmake15
-rw-r--r--include/llvm/Support/DataTypes.h.in15
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp3
-rw-r--r--lib/CodeGen/AsmPrinter/DIE.cpp4
-rw-r--r--lib/DebugInfo/DWARFDebugArangeSet.cpp5
-rw-r--r--lib/DebugInfo/DWARFDebugAranges.cpp7
-rw-r--r--lib/DebugInfo/DWARFDebugLine.cpp2
-rw-r--r--lib/DebugInfo/DWARFFormValue.cpp6
-rw-r--r--lib/Support/Timer.cpp2
-rw-r--r--lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp2
-rw-r--r--tools/llvm-objdump/MachODump.cpp4
-rw-r--r--tools/llvm-size/llvm-size.cpp10
12 files changed, 54 insertions, 21 deletions
diff --git a/include/llvm/Support/DataTypes.h.cmake b/include/llvm/Support/DataTypes.h.cmake
index 8c0220a489..2c03f45602 100644
--- a/include/llvm/Support/DataTypes.h.cmake
+++ b/include/llvm/Support/DataTypes.h.cmake
@@ -167,9 +167,24 @@ typedef signed int ssize_t;
# define UINT64_C(C) C##ui64
#endif
+#ifndef PRId64
+# define PRId64 "I64d"
+#endif
+#ifndef PRIi64
+# define PRIu64 "I64i"
+#endif
+#ifndef PRIo64
+# define PRIx64 "I64o"
+#endif
+#ifndef PRIu64
+# define PRIu64 "I64u"
+#endif
#ifndef PRIx64
# define PRIx64 "I64x"
#endif
+#ifndef PRIX64
+# define PRIX64 "I64X"
+#endif
#endif /* _MSC_VER */
diff --git a/include/llvm/Support/DataTypes.h.in b/include/llvm/Support/DataTypes.h.in
index 425805a166..f63d13fb47 100644
--- a/include/llvm/Support/DataTypes.h.in
+++ b/include/llvm/Support/DataTypes.h.in
@@ -167,9 +167,24 @@ typedef signed int ssize_t;
# define UINT64_C(C) C##ui64
#endif
+#ifndef PRId64
+# define PRId64 "I64d"
+#endif
+#ifndef PRIi64
+# define PRIu64 "I64i"
+#endif
+#ifndef PRIo64
+# define PRIx64 "I64o"
+#endif
+#ifndef PRIu64
+# define PRIu64 "I64u"
+#endif
#ifndef PRIx64
# define PRIx64 "I64x"
#endif
+#ifndef PRIX64
+# define PRIX64 "I64X"
+#endif
#endif /* _MSC_VER */
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 0c0fdc1268..ec4d30c511 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1759,7 +1759,8 @@ static void EmitGlobalConstantImpl(const Constant *CV, unsigned AddrSpace,
case 4:
case 8:
if (AP.isVerbose())
- AP.OutStreamer.GetCommentOS() << format("0x%llx\n", CI->getZExtValue());
+ AP.OutStreamer.GetCommentOS() << format("0x%" PRIx64 "\n",
+ CI->getZExtValue());
AP.OutStreamer.EmitIntValue(CI->getZExtValue(), Size, AddrSpace);
return;
default:
diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp
index a2dc873b69..4f2d3e5b79 100644
--- a/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -230,8 +230,8 @@ unsigned DIEInteger::SizeOf(AsmPrinter *AP, unsigned Form) const {
#ifndef NDEBUG
void DIEInteger::print(raw_ostream &O) {
- O << "Int: " << (int64_t)Integer
- << format(" 0x%llx", (unsigned long long)Integer);
+ O << "Int: " << (int64_t)Integer << " 0x";
+ O.write_hex(Integer);
}
#endif
diff --git a/lib/DebugInfo/DWARFDebugArangeSet.cpp b/lib/DebugInfo/DWARFDebugArangeSet.cpp
index b0c0354383..2efbfd1f92 100644
--- a/lib/DebugInfo/DWARFDebugArangeSet.cpp
+++ b/lib/DebugInfo/DWARFDebugArangeSet.cpp
@@ -122,8 +122,9 @@ void DWARFDebugArangeSet::dump(raw_ostream &OS) const {
const uint32_t hex_width = Header.AddrSize * 2;
for (DescriptorConstIter pos = ArangeDescriptors.begin(),
end = ArangeDescriptors.end(); pos != end; ++pos)
- OS << format("[0x%*.*llx -", hex_width, hex_width, pos->Address)
- << format(" 0x%*.*llx)\n", hex_width, hex_width, pos->getEndAddress());
+ OS << format("[0x%*.*" PRIx64 " -", hex_width, hex_width, pos->Address)
+ << format(" 0x%*.*" PRIx64 ")\n",
+ hex_width, hex_width, pos->getEndAddress());
}
diff --git a/lib/DebugInfo/DWARFDebugAranges.cpp b/lib/DebugInfo/DWARFDebugAranges.cpp
index 576d37d781..1788145356 100644
--- a/lib/DebugInfo/DWARFDebugAranges.cpp
+++ b/lib/DebugInfo/DWARFDebugAranges.cpp
@@ -100,13 +100,14 @@ void DWARFDebugAranges::dump(raw_ostream &OS) const {
const uint32_t num_ranges = getNumRanges();
for (uint32_t i = 0; i < num_ranges; ++i) {
const Range &range = Aranges[i];
- OS << format("0x%8.8x: [0x%8.8llx - 0x%8.8llx)\n", range.Offset,
- (uint64_t)range.LoPC, (uint64_t)range.HiPC());
+ OS << format("0x%8.8x: [0x%8.8" PRIx64 " - 0x%8.8" PRIx64 ")\n",
+ range.Offset, (uint64_t)range.LoPC, (uint64_t)range.HiPC());
}
}
void DWARFDebugAranges::Range::dump(raw_ostream &OS) const {
- OS << format("{0x%8.8x}: [0x%8.8llx - 0x%8.8llx)\n", Offset, LoPC, HiPC());
+ OS << format("{0x%8.8x}: [0x%8.8" PRIx64 " - 0x%8.8" PRIx64 ")\n",
+ Offset, LoPC, HiPC());
}
void DWARFDebugAranges::appendRange(uint32_t offset, uint64_t low_pc,
diff --git a/lib/DebugInfo/DWARFDebugLine.cpp b/lib/DebugInfo/DWARFDebugLine.cpp
index fe1ef78b02..0248ad3fcb 100644
--- a/lib/DebugInfo/DWARFDebugLine.cpp
+++ b/lib/DebugInfo/DWARFDebugLine.cpp
@@ -68,7 +68,7 @@ void DWARFDebugLine::Row::reset(bool default_is_stmt) {
}
void DWARFDebugLine::Row::dump(raw_ostream &OS) const {
- OS << format("0x%16.16llx %6u %6u", Address, Line, Column)
+ OS << format("0x%16.16" PRIx64 " %6u %6u", Address, Line, Column)
<< format(" %6u %3u ", File, Isa)
<< (IsStmt ? " is_stmt" : "")
<< (BasicBlock ? " basic_block" : "")
diff --git a/lib/DebugInfo/DWARFFormValue.cpp b/lib/DebugInfo/DWARFFormValue.cpp
index 705efe5549..86e28bd2e8 100644
--- a/lib/DebugInfo/DWARFFormValue.cpp
+++ b/lib/DebugInfo/DWARFFormValue.cpp
@@ -280,7 +280,7 @@ DWARFFormValue::dump(raw_ostream &OS, const DWARFCompileUnit *cu) const {
case DW_FORM_block4:
if (uvalue > 0) {
switch (Form) {
- case DW_FORM_block: OS << format("<0x%llx> ", uvalue); break;
+ case DW_FORM_block: OS << format("<0x%" PRIx64 "> ", uvalue); break;
case DW_FORM_block1: OS << format("<0x%2.2x> ", (uint8_t)uvalue); break;
case DW_FORM_block2: OS << format("<0x%4.4x> ", (uint16_t)uvalue); break;
case DW_FORM_block4: OS << format("<0x%8.8x> ", (uint32_t)uvalue); break;
@@ -330,11 +330,11 @@ DWARFFormValue::dump(raw_ostream &OS, const DWARFCompileUnit *cu) const {
break;
case DW_FORM_ref8:
cu_relative_offset = true;
- OS << format("cu + 0x%8.8llx", uvalue);
+ OS << format("cu + 0x%8.8" PRIx64, uvalue);
break;
case DW_FORM_ref_udata:
cu_relative_offset = true;
- OS << format("cu + 0x%llx", uvalue);
+ OS << format("cu + 0x%" PRIx64, uvalue);
break;
// All DW_FORM_indirect attributes should be resolved prior to calling
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp
index 03ac9632f0..598e8ad6a1 100644
--- a/lib/Support/Timer.cpp
+++ b/lib/Support/Timer.cpp
@@ -184,7 +184,7 @@ void TimeRecord::print(const TimeRecord &Total, raw_ostream &OS) const {
OS << " ";
if (Total.getMemUsed())
- OS << format("%9lld ", (long long)getMemUsed());
+ OS << format("%9" PRId64 " ", (int64_t)getMemUsed());
}
diff --git a/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp b/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
index 029d491260..8f26d9f4dd 100644
--- a/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
+++ b/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
@@ -97,7 +97,7 @@ void X86ATTInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
O << '$' << (int64_t)Op.getImm();
if (CommentStream && (Op.getImm() > 255 || Op.getImm() < -256))
- *CommentStream << format("imm = 0x%llX\n", (long long)Op.getImm());
+ *CommentStream << format("imm = 0x%" PRIX64 "\n", (uint64_t)Op.getImm());
} else {
assert(Op.isExpr() && "unknown operand kind in printOperand");
diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp
index 2420dd7a2b..a539f1d2cb 100644
--- a/tools/llvm-objdump/MachODump.cpp
+++ b/tools/llvm-objdump/MachODump.cpp
@@ -459,7 +459,7 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
DebugOut, nulls())) {
uint64_t SectAddress = 0;
Sections[SectIdx].getAddress(SectAddress);
- outs() << format("%8llx:\t", SectAddress + Index);
+ outs() << format("%8" PRIx64 ":\t", SectAddress + Index);
DumpBytes(StringRef(Bytes.data() + Index, Size));
IP->printInst(&Inst, outs(), "");
@@ -579,7 +579,7 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
outs() << FunctionMap[SectAddress + Inst.Address]-> getName()
<< ":\n";
- outs() << format("%8llx:\t", SectAddress + Inst.Address);
+ outs() << format("%8" PRIx64 ":\t", SectAddress + Inst.Address);
DumpBytes(StringRef(Bytes.data() + Inst.Address, Inst.Size));
if (fi->second.contains(fi->first)) // Indent simple loops.
diff --git a/tools/llvm-size/llvm-size.cpp b/tools/llvm-size/llvm-size.cpp
index 70e5cb9439..462da40afb 100644
--- a/tools/llvm-size/llvm-size.cpp
+++ b/tools/llvm-size/llvm-size.cpp
@@ -96,13 +96,13 @@ static void PrintObjectSectionSizes(ObjectFile *o) {
const char *radix_fmt = 0;
switch (Radix) {
case octal:
- radix_fmt = "llo";
+ radix_fmt = PRIo64;
break;
case decimal:
- radix_fmt = "llu";
+ radix_fmt = PRIu64;
break;
case hexadecimal:
- radix_fmt = "llx";
+ radix_fmt = PRIx64;
break;
}
if (OutputFormat == sysv) {
@@ -223,8 +223,8 @@ static void PrintObjectSectionSizes(ObjectFile *o) {
total_data,
total_bss);
fmtbuf.clear();
- fmt << "%7" << (Radix == octal ? "llo" : "llu") << " "
- << "%7llx ";
+ fmt << "%7" << (Radix == octal ? PRIo64 : PRIu64) << " "
+ << "%7" PRIx64 " ";
outs() << format(fmt.str().c_str(),
total,
total);