summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
diff options
context:
space:
mode:
authorEugene Zelenko <eugene.zelenko@gmail.com>2017-08-17 21:26:39 +0000
committerEugene Zelenko <eugene.zelenko@gmail.com>2017-08-17 21:26:39 +0000
commit6e07bfd0d91eca5170328ffa634d0d4a27e65f0a (patch)
treeb83e49227f0f5bdd9e10491275fecd5ed3146670 /llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
parentd2e57981fd616e1a5286b1fd98330b4954500d14 (diff)
downloadbcm5719-llvm-6e07bfd0d91eca5170328ffa634d0d4a27e65f0a.tar.gz
bcm5719-llvm-6e07bfd0d91eca5170328ffa634d0d4a27e65f0a.zip
[CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 311124
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp52
1 files changed, 29 insertions, 23 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
index 9c324ea26ac..c21b3d3451a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
@@ -1,4 +1,4 @@
-//=-- llvm/CodeGen/DwarfAccelTable.cpp - Dwarf Accelerator Tables -*- C++ -*-=//
+//===- llvm/CodeGen/DwarfAccelTable.cpp - Dwarf Accelerator Tables --------===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,16 +12,22 @@
//===----------------------------------------------------------------------===//
#include "DwarfAccelTable.h"
-#include "DwarfCompileUnit.h"
-#include "DwarfDebug.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCStreamer.h"
-#include "llvm/MC/MCSymbol.h"
-#include "llvm/Support/Debug.h"
+#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
+#include <iterator>
+#include <limits>
+#include <vector>
using namespace llvm;
@@ -142,13 +148,13 @@ void DwarfAccelTable::EmitBuckets(AsmPrinter *Asm) {
unsigned index = 0;
for (size_t i = 0, e = Buckets.size(); i < e; ++i) {
Asm->OutStreamer->AddComment("Bucket " + Twine(i));
- if (Buckets[i].size() != 0)
+ if (!Buckets[i].empty())
Asm->EmitInt32(index);
else
- Asm->EmitInt32(UINT32_MAX);
+ Asm->EmitInt32(std::numeric_limits<uint32_t>::max());
// Buckets point in the list of hashes, not to the data. Do not
// increment the index multiple times in case of hash collisions.
- uint64_t PrevHash = UINT64_MAX;
+ uint64_t PrevHash = std::numeric_limits<uint64_t>::max();
for (auto *HD : Buckets[i]) {
uint32_t HashValue = HD->HashValue;
if (PrevHash != HashValue)
@@ -161,7 +167,7 @@ void DwarfAccelTable::EmitBuckets(AsmPrinter *Asm) {
// Walk through the buckets and emit the individual hashes for each
// bucket.
void DwarfAccelTable::EmitHashes(AsmPrinter *Asm) {
- uint64_t PrevHash = UINT64_MAX;
+ uint64_t PrevHash = std::numeric_limits<uint64_t>::max();
for (size_t i = 0, e = Buckets.size(); i < e; ++i) {
for (HashList::const_iterator HI = Buckets[i].begin(),
HE = Buckets[i].end();
@@ -181,7 +187,7 @@ void DwarfAccelTable::EmitHashes(AsmPrinter *Asm) {
// beginning of the section. The non-section symbol will be output later
// when we emit the actual data.
void DwarfAccelTable::emitOffsets(AsmPrinter *Asm, const MCSymbol *SecBegin) {
- uint64_t PrevHash = UINT64_MAX;
+ uint64_t PrevHash = std::numeric_limits<uint64_t>::max();
for (size_t i = 0, e = Buckets.size(); i < e; ++i) {
for (HashList::const_iterator HI = Buckets[i].begin(),
HE = Buckets[i].end();
@@ -205,13 +211,14 @@ void DwarfAccelTable::emitOffsets(AsmPrinter *Asm, const MCSymbol *SecBegin) {
// Terminate each HashData bucket with 0.
void DwarfAccelTable::EmitData(AsmPrinter *Asm, DwarfDebug *D) {
for (size_t i = 0, e = Buckets.size(); i < e; ++i) {
- uint64_t PrevHash = UINT64_MAX;
+ uint64_t PrevHash = std::numeric_limits<uint64_t>::max();
for (HashList::const_iterator HI = Buckets[i].begin(),
HE = Buckets[i].end();
HI != HE; ++HI) {
// Terminate the previous entry if there is no hash collision
// with the current one.
- if (PrevHash != UINT64_MAX && PrevHash != (*HI)->HashValue)
+ if (PrevHash != std::numeric_limits<uint64_t>::max() &&
+ PrevHash != (*HI)->HashValue)
Asm->EmitInt32(0);
// Remember to emit the label for our offset.
Asm->OutStreamer->EmitLabel((*HI)->Sym);
@@ -257,31 +264,30 @@ void DwarfAccelTable::emit(AsmPrinter *Asm, const MCSymbol *SecBegin,
}
#ifndef NDEBUG
-void DwarfAccelTable::print(raw_ostream &O) {
-
- Header.print(O);
- HeaderData.print(O);
+void DwarfAccelTable::print(raw_ostream &OS) {
+ Header.print(OS);
+ HeaderData.print(OS);
- O << "Entries: \n";
+ OS << "Entries: \n";
for (StringMap<DataArray>::const_iterator EI = Entries.begin(),
EE = Entries.end();
EI != EE; ++EI) {
- O << "Name: " << EI->getKeyData() << "\n";
+ OS << "Name: " << EI->getKeyData() << "\n";
for (HashDataContents *HD : EI->second.Values)
- HD->print(O);
+ HD->print(OS);
}
- O << "Buckets and Hashes: \n";
+ OS << "Buckets and Hashes: \n";
for (size_t i = 0, e = Buckets.size(); i < e; ++i)
for (HashList::const_iterator HI = Buckets[i].begin(),
HE = Buckets[i].end();
HI != HE; ++HI)
- (*HI)->print(O);
+ (*HI)->print(OS);
- O << "Data: \n";
+ OS << "Data: \n";
for (std::vector<HashData *>::const_iterator DI = Data.begin(),
DE = Data.end();
DI != DE; ++DI)
- (*DI)->print(O);
+ (*DI)->print(OS);
}
#endif
OpenPOWER on IntegriCloud