[DebugInfoMetadata] Refactor DIExpression::prepend constants (NFC)
Refactor DIExpression::With* into a flag enum in order to be less
error-prone to use (as discussed on D60866).
Patch by Djordje Todorovic.
Differential Revision: https://reviews.llvm.org/D61943
llvm-svn: 361137
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index d23d42d..fa8438e 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -979,17 +979,18 @@
return Expr;
}
-DIExpression *DIExpression::prepend(const DIExpression *Expr, bool DerefBefore,
- int64_t Offset, bool DerefAfter,
- bool StackValue) {
+DIExpression *DIExpression::prepend(const DIExpression *Expr, uint8_t Flags,
+ int64_t Offset) {
SmallVector<uint64_t, 8> Ops;
- if (DerefBefore)
+ if (Flags & DIExpression::DerefBefore)
Ops.push_back(dwarf::DW_OP_deref);
appendOffset(Ops, Offset);
- if (DerefAfter)
+ if (Flags & DIExpression::DerefAfter)
Ops.push_back(dwarf::DW_OP_deref);
+ bool StackValue = Flags & DIExpression::StackValue;
+
return prependOpcodes(Expr, Ops, StackValue);
}