[CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 311124
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index d7042c8..b9f17d6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -1,4 +1,4 @@
-//===-- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework ------*- C++ -*--===//
+//===- llvm/CodeGen/DwarfDebug.h - Dwarf Debug Framework --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,39 +14,52 @@
#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H
+#include "AddressPool.h"
#include "DbgValueHistoryCalculator.h"
#include "DebugHandlerBase.h"
#include "DebugLocStream.h"
#include "DwarfAccelTable.h"
#include "DwarfFile.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
-#include "llvm/CodeGen/DIE.h"
-#include "llvm/CodeGen/LexicalScopes.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/IR/DebugInfo.h"
+#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
+#include "llvm/IR/Metadata.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Target/TargetOptions.h"
+#include <cassert>
+#include <cstdint>
+#include <limits>
#include <memory>
+#include <utility>
+#include <vector>
namespace llvm {
class AsmPrinter;
class ByteStreamer;
-class ConstantInt;
-class ConstantFP;
class DebugLocEntry;
+class DIE;
class DwarfCompileUnit;
-class DwarfDebug;
class DwarfTypeUnit;
class DwarfUnit;
-class MachineModuleInfo;
+class LexicalScope;
+class MachineFunction;
+class MCSection;
+class MCSymbol;
+class MDNode;
+class Module;
//===----------------------------------------------------------------------===//
/// This class is used to track local variable information.
@@ -88,7 +101,7 @@
assert(!MInsn && "Already initialized?");
assert((!E || E->isValid()) && "Expected valid expression");
- assert(FI != INT_MAX && "Expected valid index");
+ assert(FI != std::numeric_limits<int>::max() && "Expected valid index");
FrameIndexExprs.push_back({FI, E});
}
@@ -110,10 +123,12 @@
// Accessors.
const DILocalVariable *getVariable() const { return Var; }
const DILocation *getInlinedAt() const { return IA; }
+
const DIExpression *getSingleExpression() const {
assert(MInsn && FrameIndexExprs.size() <= 1);
return FrameIndexExprs.size() ? FrameIndexExprs[0].Expr : nullptr;
}
+
void setDIE(DIE &D) { TheDIE = &D; }
DIE *getDIE() const { return TheDIE; }
void setDebugLocListIndex(unsigned O) { DebugLocListIndex = O; }
@@ -141,10 +156,10 @@
return;
}
FrameIndexExprs.append(V.FrameIndexExprs.begin(), V.FrameIndexExprs.end());
- assert(all_of(FrameIndexExprs,
- [](FrameIndexExpr &FIE) {
- return FIE.Expr && FIE.Expr->isFragment();
- }) &&
+ assert(llvm::all_of(FrameIndexExprs,
+ [](FrameIndexExpr &FIE) {
+ return FIE.Expr && FIE.Expr->isFragment();
+ }) &&
"conflicting locations for variable");
}
@@ -156,6 +171,7 @@
return dwarf::DW_TAG_variable;
}
+
/// Return true if DbgVariable is artificial.
bool isArtificial() const {
if (Var->isArtificial())
@@ -181,6 +197,7 @@
"Invalid Expr for DBG_VALUE");
return !FrameIndexExprs.empty();
}
+
bool isBlockByrefVariable() const;
const DIType *getType() const;
@@ -190,10 +207,10 @@
}
};
-
/// Helper used to pair up a symbol and its DWARF compile unit.
struct SymbolCU {
SymbolCU(DwarfCompileUnit *CU, const MCSymbol *Sym) : Sym(Sym), CU(CU) {}
+
const MCSymbol *Sym;
DwarfCompileUnit *CU;
};
@@ -229,7 +246,7 @@
ProcessedSPNodes;
/// If nonnull, stores the current machine function we're processing.
- const MachineFunction *CurFn;
+ const MachineFunction *CurFn = nullptr;
/// If nonnull, stores the CU in which the previous subprogram was contained.
const DwarfCompileUnit *PrevCU;
@@ -295,7 +312,7 @@
DwarfAccelTable AccelTypes;
// Identify a debugger for "tuning" the debug info.
- DebuggerKind DebuggerTuning;
+ DebuggerKind DebuggerTuning = DebuggerKind::Default;
/// \defgroup DebuggerTuning Predicates to tune DWARF for a given debugger.
///
@@ -313,7 +330,7 @@
return InfoHolder.getUnits();
}
- typedef DbgValueHistoryMap::InlinedVariable InlinedVariable;
+ using InlinedVariable = DbgValueHistoryMap::InlinedVariable;
void ensureAbstractVariableIsCreated(DwarfCompileUnit &CU, InlinedVariable Var,
const MDNode *Scope);
@@ -562,6 +579,7 @@
bool hasDwarfPubSections(bool includeMinimalInlineScopes) const;
};
-} // End of namespace llvm
-#endif
+} // end namespace llvm
+
+#endif // LLVM_LIB_CODEGEN_ASMPRINTER_DWARFDEBUG_H