aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/LineIterator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/LineIterator.cpp')
-rw-r--r--llvm/lib/Support/LineIterator.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Support/LineIterator.cpp b/llvm/lib/Support/LineIterator.cpp
index 164436a..7bdf127 100644
--- a/llvm/lib/Support/LineIterator.cpp
+++ b/llvm/lib/Support/LineIterator.cpp
@@ -33,7 +33,11 @@ static bool skipIfAtLineEnd(const char *&P) {
line_iterator::line_iterator(const MemoryBuffer &Buffer, bool SkipBlanks,
char CommentMarker)
- : Buffer(Buffer.getBufferSize() ? &Buffer : nullptr),
+ : line_iterator(Buffer.getMemBufferRef(), SkipBlanks, CommentMarker) {}
+
+line_iterator::line_iterator(const MemoryBufferRef &Buffer, bool SkipBlanks,
+ char CommentMarker)
+ : Buffer(Buffer.getBufferSize() ? Optional<MemoryBufferRef>(Buffer) : None),
CommentMarker(CommentMarker), SkipBlanks(SkipBlanks), LineNumber(1),
CurrentLine(Buffer.getBufferSize() ? Buffer.getBufferStart() : nullptr,
0) {
@@ -78,7 +82,7 @@ void line_iterator::advance() {
if (*Pos == '\0') {
// We've hit the end of the buffer, reset ourselves to the end state.
- Buffer = nullptr;
+ Buffer = None;
CurrentLine = StringRef();
return;
}