[PATCH] Added Lexer::getBufferEnd().
Alexander Kornienko
alexfh at google.com
Tue Jun 4 09:49:23 PDT 2013
Luckily getBufferStart only has one user. Replaced getBufferStart+getBufferEnd
with to StringRef getBuffer().
Hi jordan_rose,
http://llvm-reviews.chandlerc.com/D916
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D916?vs=2261&id=2263#toc
Files:
include/clang/Lex/Lexer.h
lib/Rewrite/Core/HTMLRewrite.cpp
Index: include/clang/Lex/Lexer.h
===================================================================
--- include/clang/Lex/Lexer.h
+++ include/clang/Lex/Lexer.h
@@ -202,7 +202,10 @@
/// lexer has nothing to reset to.
void resetExtendedTokenMode();
- const char *getBufferStart() const { return BufferStart; }
+ /// Gets source code buffer.
+ StringRef getBuffer() const {
+ return StringRef(BufferStart, BufferEnd - BufferStart);
+ }
/// ReadToEndOfLine - Read the rest of the current preprocessor line as an
/// uninterpreted string. This switches the lexer out of directive mode.
Index: lib/Rewrite/Core/HTMLRewrite.cpp
===================================================================
--- lib/Rewrite/Core/HTMLRewrite.cpp
+++ lib/Rewrite/Core/HTMLRewrite.cpp
@@ -361,7 +361,7 @@
const SourceManager &SM = PP.getSourceManager();
const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID);
Lexer L(FID, FromFile, SM, PP.getLangOpts());
- const char *BufferStart = L.getBufferStart();
+ const char *BufferStart = L.getBuffer().data();
// Inform the preprocessor that we want to retain comments as tokens, so we
// can highlight them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D916.2.patch
Type: text/x-patch
Size: 1175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130604/b26115e5/attachment.bin>
More information about the cfe-commits
mailing list