Run clang-format on DwarfExpression (NFC)

This commit is contained in:
Adrian Prantl 2020-01-29 10:22:15 -08:00
parent 816ee8a423
commit 18dbe1b279
2 changed files with 24 additions and 36 deletions

View File

@ -40,12 +40,12 @@ void DwarfExpression::emitConstu(uint64_t Value) {
}
void DwarfExpression::addReg(int DwarfReg, const char *Comment) {
assert(DwarfReg >= 0 && "invalid negative dwarf register number");
assert((isUnknownLocation() || isRegisterLocation()) &&
"location description already locked down");
LocationKind = Register;
if (DwarfReg < 32) {
emitOp(dwarf::DW_OP_reg0 + DwarfReg, Comment);
assert(DwarfReg >= 0 && "invalid negative dwarf register number");
assert((isUnknownLocation() || isRegisterLocation()) &&
"location description already locked down");
LocationKind = Register;
if (DwarfReg < 32) {
emitOp(dwarf::DW_OP_reg0 + DwarfReg, Comment);
} else {
emitOp(dwarf::DW_OP_regx, Comment);
emitUnsigned(DwarfReg);
@ -248,8 +248,8 @@ bool DwarfExpression::addMachineRegExpression(const TargetRegisterInfo &TRI,
// a call site parameter expression and if that expression is just a register
// location, emit it with addBReg and offset 0, because we should emit a DWARF
// expression representing a value, rather than a location.
if (!isMemoryLocation() && !HasComplexExpression && (!isParameterValue() ||
isEntryValue())) {
if (!isMemoryLocation() && !HasComplexExpression &&
(!isParameterValue() || isEntryValue())) {
for (auto &Reg : DwarfRegs) {
if (Reg.DwarfRegNo >= 0)
addReg(Reg.DwarfRegNo, Reg.Comment);
@ -363,7 +363,8 @@ unsigned DwarfExpression::getOrCreateBaseType(unsigned BitSize,
return I;
}
/// Assuming a well-formed expression, match "DW_OP_deref* DW_OP_LLVM_fragment?".
/// Assuming a well-formed expression, match "DW_OP_deref*
/// DW_OP_LLVM_fragment?".
static bool isMemoryLocation(DIExpressionCursor ExprCursor) {
while (ExprCursor) {
auto Op = ExprCursor.take();

View File

@ -150,29 +150,17 @@ protected:
unsigned DwarfVersion : 4;
public:
bool isUnknownLocation() const {
return LocationKind == Unknown;
}
bool isUnknownLocation() const { return LocationKind == Unknown; }
bool isMemoryLocation() const {
return LocationKind == Memory;
}
bool isMemoryLocation() const { return LocationKind == Memory; }
bool isRegisterLocation() const {
return LocationKind == Register;
}
bool isRegisterLocation() const { return LocationKind == Register; }
bool isImplicitLocation() const {
return LocationKind == Implicit;
}
bool isImplicitLocation() const { return LocationKind == Implicit; }
bool isEntryValue() const {
return LocationFlags & EntryValue;
}
bool isEntryValue() const { return LocationFlags & EntryValue; }
bool isParameterValue() {
return LocationFlags & CallSiteParamValue;
}
bool isParameterValue() { return LocationFlags & CallSiteParamValue; }
Optional<uint8_t> TagOffset;
@ -222,7 +210,8 @@ protected:
/// Return whether the given machine register is the frame register in the
/// current function.
virtual bool isFrameRegister(const TargetRegisterInfo &TRI, unsigned MachineReg) = 0;
virtual bool isFrameRegister(const TargetRegisterInfo &TRI,
unsigned MachineReg) = 0;
/// Emit a DW_OP_reg operation. Note that this is only legal inside a DWARF
/// register location description.
@ -279,7 +268,7 @@ protected:
/// Finalize an entry value by emitting its size operand, and committing the
/// DWARF block which has been emitted to the temporary buffer.
void finalizeEntryValue();
~DwarfExpression() = default;
public:
@ -307,14 +296,10 @@ public:
}
/// Lock this down to become an entry value location.
void setEntryValueFlag() {
LocationFlags |= EntryValue;
}
void setEntryValueFlag() { LocationFlags |= EntryValue; }
/// Lock this down to become a call site parameter location.
void setCallSiteParamValueFlag() {
LocationFlags |= CallSiteParamValue;
}
void setCallSiteParamValueFlag() { LocationFlags |= CallSiteParamValue; }
/// Emit a machine register location. As an optimization this may also consume
/// the prefix of a DwarfExpression if a more efficient representation for
@ -339,7 +324,7 @@ public:
/// Return the index of a base type with the given properties and
/// create one if necessary.
unsigned getOrCreateBaseType(unsigned BitSize, dwarf::TypeKind Encoding);
/// Emit all remaining operations in the DIExpressionCursor.
///
/// \param FragmentOffsetInBits If this is one fragment out of multiple
@ -391,6 +376,7 @@ class DebugLocDwarfExpression final : public DwarfExpression {
bool isFrameRegister(const TargetRegisterInfo &TRI,
unsigned MachineReg) override;
public:
DebugLocDwarfExpression(unsigned DwarfVersion, BufferByteStreamer &BS,
DwarfCompileUnit &CU)
@ -420,6 +406,7 @@ class DIEDwarfExpression final : public DwarfExpression {
bool isFrameRegister(const TargetRegisterInfo &TRI,
unsigned MachineReg) override;
public:
DIEDwarfExpression(const AsmPrinter &AP, DwarfCompileUnit &CU, DIELoc &DIE);