1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

Fix unused lambda capture in a non-asserts build

For locally scoped lambdas like this there's no particular benefit to
explicitly listing captures - or avoiding capturing this. Switch to [&]
and make it all easier to maintain.

(& driveby change std::function to llvm::function_ref)
This commit is contained in:
David Blaikie 2021-03-11 00:21:02 -08:00
parent 1de679fe12
commit 82a7e62f0f
3 changed files with 5 additions and 8 deletions

View File

@ -775,10 +775,7 @@ DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,
DIExpressionCursor Cursor(Expr);
const TargetRegisterInfo &TRI = *Asm->MF->getSubtarget().getRegisterInfo();
// Declare the TargetMachine locally so we don't need to capture `this` in
// the lambda.
TargetMachine &TM = Asm->TM;
auto AddEntry = [&DwarfExpr, &TRI, &TM](const DbgValueLocEntry &Entry,
auto AddEntry = [&](const DbgValueLocEntry &Entry,
DIExpressionCursor &Cursor) {
if (Entry.isLocation()) {
if (!DwarfExpr.addMachineRegExpression(TRI, Cursor,
@ -797,7 +794,7 @@ DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,
TargetIndexLocation Loc = Entry.getTargetIndexLocation();
// TODO TargetIndexLocation is a target-independent. Currently only the
// WebAssembly-specific encoding is supported.
assert(TM.getTargetTriple().isWasm());
assert(Asm->TM.getTargetTriple().isWasm());
DwarfExpr.addWasmLocation(Loc.Index, static_cast<uint64_t>(Loc.Offset));
} else {
llvm_unreachable("Unsupported Entry type.");
@ -807,7 +804,7 @@ DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,
DwarfExpr.addExpression(
std::move(Cursor),
[&AddEntry, &DVal](unsigned Idx, DIExpressionCursor &Cursor) -> bool {
[&](unsigned Idx, DIExpressionCursor &Cursor) -> bool {
return AddEntry(DVal->getLocEntries()[Idx], Cursor);
});

View File

@ -473,7 +473,7 @@ void DwarfExpression::addExpression(DIExpressionCursor &&ExprCursor,
void DwarfExpression::addExpression(
DIExpressionCursor &&ExprCursor,
std::function<bool(unsigned, DIExpressionCursor &)> InsertArg) {
llvm::function_ref<bool(unsigned, DIExpressionCursor &)> InsertArg) {
// Entry values can currently only cover the initial register location,
// and not any other parts of the following DWARF expression.
assert(!IsEmittingEntryValue && "Can't emit entry value around expression");

View File

@ -349,7 +349,7 @@ public:
unsigned FragmentOffsetInBits = 0);
void
addExpression(DIExpressionCursor &&Expr,
std::function<bool(unsigned, DIExpressionCursor &)> InsertArg);
llvm::function_ref<bool(unsigned, DIExpressionCursor &)> InsertArg);
/// If applicable, emit an empty DW_OP_piece / DW_OP_bit_piece to advance to
/// the fragment described by \c Expr.