summaryrefslogtreecommitdiff
path: root/tools/llvm-readobj
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-readobj')
-rw-r--r--tools/llvm-readobj/ARMAttributeParser.cpp60
-rw-r--r--tools/llvm-readobj/COFFDumper.cpp13
-rw-r--r--tools/llvm-readobj/ELFDumper.cpp3
3 files changed, 39 insertions, 37 deletions
diff --git a/tools/llvm-readobj/ARMAttributeParser.cpp b/tools/llvm-readobj/ARMAttributeParser.cpp
index cd0bcd4cb98..d35cd14265f 100644
--- a/tools/llvm-readobj/ARMAttributeParser.cpp
+++ b/tools/llvm-readobj/ARMAttributeParser.cpp
@@ -126,7 +126,7 @@ void ARMAttributeParser::CPU_arch(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -153,7 +153,7 @@ void ARMAttributeParser::ARM_ISA_use(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -163,7 +163,7 @@ void ARMAttributeParser::THUMB_ISA_use(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -176,7 +176,7 @@ void ARMAttributeParser::FP_arch(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -186,7 +186,7 @@ void ARMAttributeParser::WMMX_arch(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -198,7 +198,7 @@ void ARMAttributeParser::Advanced_SIMD_arch(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -211,7 +211,7 @@ void ARMAttributeParser::PCS_config(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -221,7 +221,7 @@ void ARMAttributeParser::ABI_PCS_R9_use(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -233,7 +233,7 @@ void ARMAttributeParser::ABI_PCS_RW_data(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -243,7 +243,7 @@ void ARMAttributeParser::ABI_PCS_RO_data(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -253,7 +253,7 @@ void ARMAttributeParser::ABI_PCS_GOT_use(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -265,7 +265,7 @@ void ARMAttributeParser::ABI_PCS_wchar_t(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -275,7 +275,7 @@ void ARMAttributeParser::ABI_FP_rounding(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -285,7 +285,7 @@ void ARMAttributeParser::ABI_FP_denormal(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -295,7 +295,7 @@ void ARMAttributeParser::ABI_FP_exceptions(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -306,7 +306,7 @@ void ARMAttributeParser::ABI_FP_user_exceptions(AttrType Tag,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -318,7 +318,7 @@ void ARMAttributeParser::ABI_FP_number_model(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -371,7 +371,7 @@ void ARMAttributeParser::ABI_enum_size(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -383,7 +383,7 @@ void ARMAttributeParser::ABI_HardFP_use(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -395,7 +395,7 @@ void ARMAttributeParser::ABI_VFP_args(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -405,7 +405,7 @@ void ARMAttributeParser::ABI_WMMX_args(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -419,7 +419,7 @@ void ARMAttributeParser::ABI_optimization_goals(AttrType Tag,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -433,7 +433,7 @@ void ARMAttributeParser::ABI_FP_optimization_goals(AttrType Tag,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -465,7 +465,7 @@ void ARMAttributeParser::CPU_unaligned_access(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -475,7 +475,7 @@ void ARMAttributeParser::FP_HP_extension(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -485,7 +485,7 @@ void ARMAttributeParser::ABI_FP_16bit_format(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -495,7 +495,7 @@ void ARMAttributeParser::MPextension_use(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -507,7 +507,7 @@ void ARMAttributeParser::DIV_use(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -517,7 +517,7 @@ void ARMAttributeParser::T2EE_use(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
@@ -530,7 +530,7 @@ void ARMAttributeParser::Virtualization_use(AttrType Tag, const uint8_t *Data,
uint64_t Value = ParseInteger(Data, Offset);
StringRef ValueDesc =
- (Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
+ (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
PrintAttribute(Tag, Value, ValueDesc);
}
diff --git a/tools/llvm-readobj/COFFDumper.cpp b/tools/llvm-readobj/COFFDumper.cpp
index 48edf78a3d5..b53520daefb 100644
--- a/tools/llvm-readobj/COFFDumper.cpp
+++ b/tools/llvm-readobj/COFFDumper.cpp
@@ -534,7 +534,7 @@ void COFFDumper::printDataDirectory(uint32_t Index, const std::string &FieldName
void COFFDumper::printFileHeaders() {
// Print COFF header
- const coff_file_header *COFFHeader = 0;
+ const coff_file_header *COFFHeader = nullptr;
if (error(Obj->getCOFFHeader(COFFHeader)))
return;
@@ -557,13 +557,13 @@ void COFFDumper::printFileHeaders() {
// Print PE header. This header does not exist if this is an object file and
// not an executable.
- const pe32_header *PEHeader = 0;
+ const pe32_header *PEHeader = nullptr;
if (error(Obj->getPE32Header(PEHeader)))
return;
if (PEHeader)
printPEHeader<pe32_header>(PEHeader);
- const pe32plus_header *PEPlusHeader = 0;
+ const pe32plus_header *PEPlusHeader = nullptr;
if (error(Obj->getPE32PlusHeader(PEPlusHeader)))
return;
if (PEPlusHeader)
@@ -693,7 +693,7 @@ void COFFDumper::printCodeViewLineTables(const SectionRef &Section) {
break;
}
case COFF::DEBUG_STRING_TABLE_SUBSECTION:
- if (PayloadSize == 0 || StringTable.data() != 0 ||
+ if (PayloadSize == 0 || StringTable.data() != nullptr ||
Contents.back() != '\0') {
// Empty or duplicate or non-null-terminated subsection.
error(object_error::parse_failed);
@@ -705,7 +705,8 @@ void COFFDumper::printCodeViewLineTables(const SectionRef &Section) {
// Holds the translation table from file indices
// to offsets in the string table.
- if (PayloadSize == 0 || FileIndexToStringOffsetTable.data() != 0) {
+ if (PayloadSize == 0 ||
+ FileIndexToStringOffsetTable.data() != nullptr) {
// Empty or duplicate subsection.
error(object_error::parse_failed);
return;
@@ -1090,7 +1091,7 @@ void COFFDumper::printRuntimeFunction(
W.printString("UnwindInfoAddress",
formatSymbol(Rels, OffsetInSection + 8, RTF.UnwindInfoOffset));
- const coff_section* XData = 0;
+ const coff_section* XData = nullptr;
uint64_t UnwindInfoOffset = 0;
if (error(getSection(Rels, OffsetInSection + 8, &XData, &UnwindInfoOffset)))
return;
diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp
index 4cd339347ad..ab898327ca2 100644
--- a/tools/llvm-readobj/ELFDumper.cpp
+++ b/tools/llvm-readobj/ELFDumper.cpp
@@ -652,7 +652,8 @@ void ELFDumper<ELFT>::printSymbol(typename ELFO::Elf_Sym_Iter Symbol) {
std::string FullSymbolName(SymbolName);
if (Symbol.isDynamic()) {
bool IsDefault;
- ErrorOr<StringRef> Version = Obj->getSymbolVersion(0, &*Symbol, IsDefault);
+ ErrorOr<StringRef> Version = Obj->getSymbolVersion(nullptr, &*Symbol,
+ IsDefault);
if (Version) {
FullSymbolName += (IsDefault ? "@@" : "@");
FullSymbolName += *Version;