diff options
author | JesseChen <56120624+JesseCodeBones@users.noreply.github.com> | 2023-08-29 03:55:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-28 12:55:25 -0700 |
commit | 059893936ff1c44cf128b14a526fb7ed32a5f285 (patch) | |
tree | e75d1ec593204381c7b3eaac92a0274cddf9088d /src | |
parent | 0e5ee1cb368548f6890efcc05c980d5bb56f27d6 (diff) | |
download | binaryen-059893936ff1c44cf128b14a526fb7ed32a5f285.tar.gz binaryen-059893936ff1c44cf128b14a526fb7ed32a5f285.tar.bz2 binaryen-059893936ff1c44cf128b14a526fb7ed32a5f285.zip |
Improve debug info printing with depth (#5903)
Skip repeated identical debug info only of more-nested nodes. Before this PR we
skipped sibling nodes and even parent nodes, which could be confusing. After
this PR there is a more clear connection: child nodes have the same debug location
as the parent, by default, and so there is no need to print it again.
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/Print.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 7f06f8c17..3ae7b6899 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -170,6 +170,8 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { std::vector<HeapType> heapTypes; + unsigned lastPrintIndent = 0; + // Print type names by saved name or index if we have a module, or otherwise // by generating minimalist names. TODO: Handle conflicts between // user-provided names and the fallback indexed names. @@ -2375,10 +2377,11 @@ std::ostream& PrintSExpression::printPrefixedTypes(const char* prefix, void PrintSExpression::printDebugLocation( const Function::DebugLocation& location) { - if (lastPrintedLocation == location) { + if (lastPrintedLocation == location && indent > lastPrintIndent) { return; } lastPrintedLocation = location; + lastPrintIndent = indent; auto fileName = currModule->debugInfoFileNames[location.fileIndex]; o << ";;@ " << fileName << ":" << location.lineNumber << ":" << location.columnNumber << '\n'; |