[lld] [LLD] Improve linker script handing in LLD (PR #106334)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 15:01:03 PDT 2024


================
@@ -131,6 +132,152 @@ uint64_t ExprValue::getSectionOffset() const {
   return getValue() - getSecAddr();
 }
 
+ExprValue ScriptExpr::getExprValue() const {
+  switch (kind_) {
+  case ExprKind::Constant:
+    return static_cast<const ConstantExpr *>(this)->getExprValue();
+  case ExprKind::Dynamic:
+    return static_cast<const DynamicExpr *>(this)->getExprValue();
+  case ExprKind::Binary:
+    return static_cast<const BinaryExpr *>(this)->getExprValue();
+  default:
+    return ExprValue(0);
+  }
+}
+
+BinaryExpr::Op BinaryExpr::stringToOp(const StringRef op) {
----------------
PiJoules wrote:

nit: is the `const` redundant here since `StringRef` already represents a constant reference?

https://github.com/llvm/llvm-project/pull/106334


More information about the llvm-commits mailing list