diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-07-30 11:50:16 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-07-30 11:50:16 +0000 |
| commit | 14bc6a676e9b687c466a972e0dc98f301c33f03c (patch) | |
| tree | 616393a6aa14cd67d394985eb8c871fedd9dd97f /contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp | |
| parent | 252b2b4f4fb7f7749f90c83e5e01ba68b5424ffa (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp')
| -rw-r--r-- | contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp b/contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp index cd8a27e76c28..e0f3966fce48 100644 --- a/contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp +++ b/contrib/llvm/tools/clang/lib/Lex/ScratchBuffer.cpp @@ -35,6 +35,14 @@ SourceLocation ScratchBuffer::getToken(const char *Buf, unsigned Len, const char *&DestPtr) { if (BytesUsed+Len+2 > ScratchBufSize) AllocScratchBuffer(Len+2); + else { + // Clear out the source line cache if it's already been computed. + // FIXME: Allow this to be incrementally extended. + auto *ContentCache = const_cast<SrcMgr::ContentCache *>( + SourceMgr.getSLocEntry(SourceMgr.getFileID(BufferStartLoc)) + .getFile().getContentCache()); + ContentCache->SourceLineCache = nullptr; + } // Prefix the token with a \n, so that it looks like it is the first thing on // its own virtual line in caret diagnostics. |
