Skip to content

Commit 0d17671

Browse files
committed
Comments
1 parent 0f681b6 commit 0d17671

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/passes/Print.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
117117

118118
Module* currModule = nullptr;
119119
Function* currFunction = nullptr;
120+
// Keep track of the last printed debug location to avoid printing
121+
// repeated debug locations for children. nullopt means that we have
122+
// not yet printed any debug location, or that we last printed an
123+
// annotation indicating that the expression had not associated
124+
// debug location.
120125
std::optional<Function::DebugLocation> lastPrintedLocation;
121126
bool debugInfo;
122127

src/wasm-ir-builder.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ class IRBuilder : public UnifiedExpressionVisitor<IRBuilder, Result<>> {
238238
Module& wasm;
239239
Function* func;
240240
Builder builder;
241+
// We distinguish three cases:
242+
// - no debug location has been specified for the next instruction;
243+
// then this instruction may inherit a debug location from its
244+
// parent or a previous sibling;
245+
// - we explicitly specified that this instruction has no debug location;
246+
// - we provided a debug location for this instruction.
241247
std::optional<std::optional<Function::DebugLocation>> debugLoc;
242248

243249
struct ChildPopper;

0 commit comments

Comments
 (0)