[PATCH] D124798: [Symbolize] Parse multi-line markup elements.
Daniel Thornburgh via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 21 11:24:44 PDT 2022
mysterymath added inline comments.
================
Comment at: llvm/lib/DebugInfo/Symbolize/Markup.cpp:73
+ // Begin recording the multi-line element.
+ assert(InProgressMultiline.empty() &&
+ "At most one multi-line element can begin at a time.");
----------------
peter.smith wrote:
> I think this could occur due to malformed input? For example
> ```
> parseLine("{{{first");
> nextElement() returns None
> parseLine("}}"); // Typo only two closing braces.
> nextElement() returns None
> parseLine("{{{second"); // Assert failure "At most one multi-line element can begin at a time"
> ```
> Would imply that an assertions build would crash on malformed input, but would append `{{{second` to the in progress multiline otherwise. I think this would be useful to report as a parse error. An assert seems like it is more appropriate for a coding error (misuse of the API).
This assertion shouldn't ever be tripped; there's an early `if(!InProgressMultiline.empty()) continue/return`. I've removed it, as it didn't add much clarity.
For the example you gave, the current behavior would be to consider this a multi-line element with tag `first` (presuming the first line was `{{{first:`; multi-line elements have to begin with the field delimiter) and with the contents being everything else given. No elements would be emitted since the end tag still hasn't been seen, if `flush()` were called, the text would be scanned for control codes and emitted.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124798/new/
https://reviews.llvm.org/D124798
More information about the llvm-commits
mailing list