LLVM
13.0.0git
|
A forward iterator which reads text lines from a buffer. More...
#include "llvm/Support/LineIterator.h"
Public Member Functions | |
line_iterator ()=default | |
Default construct an "end" iterator. More... | |
line_iterator (const MemoryBufferRef &Buffer, bool SkipBlanks=true, char CommentMarker='\0') | |
Construct a new iterator around an unowned memory buffer. More... | |
line_iterator (const MemoryBuffer &Buffer, bool SkipBlanks=true, char CommentMarker='\0') | |
Construct a new iterator around some memory buffer. More... | |
bool | is_at_eof () const |
Return true if we've reached EOF or are an "end" iterator. More... | |
bool | is_at_end () const |
Return true if we're an "end" iterator or have reached EOF. More... | |
int64_t | line_number () const |
Return the current line number. May return any number at EOF. More... | |
line_iterator & | operator++ () |
Advance to the next (non-empty, non-comment) line. More... | |
line_iterator | operator++ (int) |
StringRef | operator* () const |
Get the current line as a StringRef . More... | |
const StringRef * | operator-> () const |
Friends | |
bool | operator== (const line_iterator &LHS, const line_iterator &RHS) |
bool | operator!= (const line_iterator &LHS, const line_iterator &RHS) |
A forward iterator which reads text lines from a buffer.
This class provides a forward iterator interface for reading one line at a time from a buffer. When default constructed the iterator will be the "end" iterator.
The iterator is aware of what line number it is currently processing. It strips blank lines by default, and comment lines given a comment-starting character.
Note that this iterator requires the buffer to be nul terminated.
Definition at line 33 of file LineIterator.h.
|
default |
Default construct an "end" iterator.
|
explicit |
Construct a new iterator around an unowned memory buffer.
Definition at line 38 of file LineIterator.cpp.
References assert(), llvm::MemoryBufferRef::getBufferEnd(), llvm::MemoryBufferRef::getBufferSize(), llvm::MemoryBufferRef::getBufferStart(), and isAtLineEnd().
|
explicit |
Construct a new iterator around some memory buffer.
Definition at line 34 of file LineIterator.cpp.
|
inline |
Return true if we're an "end" iterator or have reached EOF.
Definition at line 58 of file LineIterator.h.
References is_at_eof().
Referenced by llvm::TextInstrProfReader::readNextRecord().
|
inline |
Return true if we've reached EOF or are an "end" iterator.
Definition at line 55 of file LineIterator.h.
Referenced by getBBClusterInfo(), llvm::sampleprof::SampleProfileReaderText::hasFormat(), is_at_end(), llvm::SymbolRemappingReader::read(), llvm::sampleprof::SampleProfileReaderText::readImpl(), and llvm::ReplayInlineAdvisor::ReplayInlineAdvisor().
|
inline |
Return the current line number. May return any number at EOF.
Definition at line 61 of file LineIterator.h.
Referenced by getBBClusterInfo(), llvm::SymbolRemappingReader::read(), and llvm::sampleprof::SampleProfileReaderText::readImpl().
|
inline |
Get the current line as a StringRef
.
Definition at line 75 of file LineIterator.h.
|
inline |
Advance to the next (non-empty, non-comment) line.
Definition at line 64 of file LineIterator.h.
|
inline |
Definition at line 68 of file LineIterator.h.
Definition at line 76 of file LineIterator.h.
|
friend |
Definition at line 83 of file LineIterator.h.
|
friend |
Definition at line 78 of file LineIterator.h.