[PATCH] D102590: [YAMLParser] Add multi-line literal folding support
Joachim Meyer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 2 08:37:46 PDT 2021
fodinabor added a comment.
Not too deep into the YAML world, so just my two cents re the `isLineBreak` function.
================
Comment at: llvm/lib/Support/YAMLParser.cpp:1049
+bool Scanner::isLineBreak(StringRef Line) {
+ return Line == "\n" || Line == "\r" || Line == "\t\n";
+}
----------------
shouldn't this rather be a check whether the line is _empty_ -> whether it contains anything else than `\n\r\t `?
Currently, this does not support empty lines with spaces, multiple tabs or windows style line feeds `\r\n`.
This would be easily solvable by using something like:
```
for(auto Position = Line.begin(); Position != Line.end(); ++Position)
if(!isBlankOrBreak(Position))
return false;
return true;
```
Renaming the function to `isLineEmpty` might sense then, too.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102590/new/
https://reviews.llvm.org/D102590
More information about the llvm-commits
mailing list