diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index e930f3def2e0..63bf58a12c8f 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -113,6 +113,8 @@ Lexer::Lexer(SourceLocation fileloc, const LangOptions &features, Is_PragmaLexer = false; InitCharacterInfo(); + // If a MemoryBuffer was specified, use its start as BufferStart. This affects + // the source location objects produced by this lexer. BufferStart = FromFile ? FromFile->getBufferStart() : BufStart; BufferPtr = BufStart; BufferEnd = BufEnd;