//===- LineIterator.h - Iterator to read a text buffer's lines --*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_LINEITERATOR_H #define LLVM_SUPPORT_LINEITERATOR_H #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/MemoryBufferRef.h" #include <iterator> #include <optional> namespace llvm { class MemoryBuffer; /// 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. class line_iterator { … }; } #endif