Details
- Reviewers
sscalpone jdoerfert - Group Reviewers
Restricted Project - Commits
- rGb547e1a4d163: [flang] Fix handling of files without terminating newlines.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
flang/lib/Parser/source.cpp | ||
---|---|---|
129–130 | Could you merge these two sections since they both deal with files that don't end with a newline character? |
@sscalpone I've mostly added this for discussion; I don't think there's another way of doing this with the way we currently handle newlines but I also don't think doing this is the best way forward. We might want to merge it to fix the bug in the short term while we look at newline handling though.
Well, currently this will crash if there isn't enough free memory with an error in the MemoryBuffer code. What other sensible behaviour is there? We can't continue if there's no memory as we'll have an infinite loop in the parser so crashing out seems the only option?
I'm asking about the case where "(content().size() >= buf_->getBufferSize())" is false.
Added test case including carriage returns; this tests the case where we already
have enough memory to add a newline at the end since we've moved the carriage
returns there.
Could you merge these two sections since they both deal with files that don't end with a newline character?