[PATCH] D143142: [clang][lex] Enable Lexer to grow its buffer
Sunho Kim via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 9 09:07:58 PST 2023
sunho added inline comments.
================
Comment at: clang/lib/Lex/Lexer.cpp:211
+ L->BufferOffset =
+ StrData - InputFile.getBufferStart(); // FIXME: this is wrong
+ L->BufferSize = L->BufferOffset + TokLen;
----------------
v.g.vassilev wrote:
> Is that an outdated comment? If not maybe elaborate why this is wrong.
It's indeed outdated comment. I'll remove it.
================
Comment at: clang/lib/Lex/Lexer.cpp:1203
if (L && !L->isLexingRawMode())
- L->Diag(CP-2, diag::trigraph_ignored);
+ L->Diag(CP - 2 - L->getBuffer().data(), diag::trigraph_ignored);
return 0;
----------------
shafik wrote:
> I wonder do we really need to do these pointer gymnastics, maybe making this a member function would eliminate the need for it.
Yes, we can change it to offset here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143142/new/
https://reviews.llvm.org/D143142
More information about the cfe-commits
mailing list