[PATCH] Added Lexer::getBufferEnd().

Alexander Kornienko alexfh at google.com
Tue Jun 4 07:41:47 PDT 2013


Hi jordan_rose,

There's Lexer::getBufferStart(), and we need getBufferEnd() to access
the whole input buffer in clang::format::reformat. We don't want to
rely on the fact that the Lexer::BufferEnd always points to '\0', as there can
be embedded '\0's as well.

http://llvm-reviews.chandlerc.com/D916

Files:
  include/clang/Lex/Lexer.h

Index: include/clang/Lex/Lexer.h
===================================================================
--- include/clang/Lex/Lexer.h
+++ include/clang/Lex/Lexer.h
@@ -202,8 +202,12 @@
   /// lexer has nothing to reset to.
   void resetExtendedTokenMode();
 
+  /// \brief Gets the start of the source buffer.
   const char *getBufferStart() const { return BufferStart; }
 
+  /// \brief Gets the end of the source buffer.
+  const char *getBufferEnd() const { return BufferEnd; }
+
   /// ReadToEndOfLine - Read the rest of the current preprocessor line as an
   /// uninterpreted string.  This switches the lexer out of directive mode.
   void ReadToEndOfLine(SmallVectorImpl<char> *Result = 0);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D916.1.patch
Type: text/x-patch
Size: 695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130604/9ce4afb1/attachment.bin>


More information about the cfe-commits mailing list