[Object] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 300779
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//===- COFFObjectFile.cpp - COFF object file implementation -----*- C++ -*-===//
|
||||
//===- COFFObjectFile.cpp - COFF object file implementation ---------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@@ -11,16 +11,28 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Object/COFF.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/Object/Binary.h"
|
||||
#include "llvm/Object/COFF.h"
|
||||
#include "llvm/Object/Error.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cctype>
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <system_error>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace object;
|
||||
@@ -116,7 +128,7 @@ const coff_symbol_type *COFFObjectFile::toSymb(DataRefImpl Ref) const {
|
||||
const coff_section *COFFObjectFile::toSec(DataRefImpl Ref) const {
|
||||
const coff_section *Addr = reinterpret_cast<const coff_section*>(Ref.p);
|
||||
|
||||
# ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
// Verify that the section points to a valid entry in the section table.
|
||||
if (Addr < SectionTable || Addr >= (SectionTable + getNumberOfSections()))
|
||||
report_fatal_error("Section was outside of section table.");
|
||||
@@ -124,7 +136,7 @@ const coff_section *COFFObjectFile::toSec(DataRefImpl Ref) const {
|
||||
uintptr_t Offset = uintptr_t(Addr) - uintptr_t(SectionTable);
|
||||
assert(Offset % sizeof(coff_section) == 0 &&
|
||||
"Section did not point to the beginning of a section");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return Addr;
|
||||
}
|
||||
@@ -985,7 +997,7 @@ COFFObjectFile::getSymbolAuxData(COFFSymbolRef Symbol) const {
|
||||
if (Symbol.getNumberOfAuxSymbols() > 0) {
|
||||
// AUX data comes immediately after the symbol in COFF
|
||||
Aux = reinterpret_cast<const uint8_t *>(Symbol.getRawPtr()) + SymbolSize;
|
||||
# ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
// Verify that the Aux symbol points to a valid entry in the symbol table.
|
||||
uintptr_t Offset = uintptr_t(Aux) - uintptr_t(base());
|
||||
if (Offset < getPointerToSymbolTable() ||
|
||||
@@ -995,7 +1007,7 @@ COFFObjectFile::getSymbolAuxData(COFFSymbolRef Symbol) const {
|
||||
|
||||
assert((Offset - getPointerToSymbolTable()) % SymbolSize == 0 &&
|
||||
"Aux Symbol data did not point to the beginning of a symbol");
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
return makeArrayRef(Aux, Symbol.getNumberOfAuxSymbols() * SymbolSize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user