summaryrefslogtreecommitdiff
path: root/src/wasm-ir-builder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-ir-builder.h')
-rw-r--r--src/wasm-ir-builder.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/wasm-ir-builder.h b/src/wasm-ir-builder.h
index 3c4a52bea..650462e12 100644
--- a/src/wasm-ir-builder.h
+++ b/src/wasm-ir-builder.h
@@ -58,7 +58,7 @@ public:
// Set the debug location to be attached to the next visited, created, or
// pushed instruction.
- void setDebugLocation(const Function::DebugLocation&);
+ void setDebugLocation(const std::optional<Function::DebugLocation>&);
// Handle the boundaries of control flow structures. Users may choose to use
// the corresponding `makeXYZ` function below instead of `visitXYZStart`, but
@@ -238,7 +238,17 @@ private:
Module& wasm;
Function* func;
Builder builder;
- std::optional<Function::DebugLocation> debugLoc;
+
+ // The location lacks debug info as it was marked as not having it.
+ struct NoDebug : public std::monostate {};
+ // The location lacks debug info, but was not marked as not having
+ // it, and it can receive it from the parent or its previous sibling
+ // (if it has one).
+ struct CanReceiveDebug : public std::monostate {};
+ using DebugVariant =
+ std::variant<NoDebug, CanReceiveDebug, Function::DebugLocation>;
+
+ DebugVariant debugLoc;
struct ChildPopper;