Take into account that there may be a BOM at the beginning of the file,

when computing the size of the precompiled preamble.

llvm-svn: 166659
This commit is contained in:
Argyrios Kyrtzidis 2012-10-25 01:51:45 +00:00
parent ec8f1ef9db
commit d53d0daab9
2 changed files with 12 additions and 3 deletions

View File

@ -513,10 +513,13 @@ Lexer::ComputePreamble(const llvm::MemoryBuffer *Buffer,
// "fake" file source location at offset 1 so that the lexer will track our
// position within the file.
const unsigned StartOffset = 1;
SourceLocation StartLoc = SourceLocation::getFromRawEncoding(StartOffset);
Lexer TheLexer(StartLoc, LangOpts, Buffer->getBufferStart(),
SourceLocation FileLoc = SourceLocation::getFromRawEncoding(StartOffset);
Lexer TheLexer(FileLoc, LangOpts, Buffer->getBufferStart(),
Buffer->getBufferStart(), Buffer->getBufferEnd());
// StartLoc will differ from FileLoc if there is a BOM that was skipped.
SourceLocation StartLoc = TheLexer.getSourceLocation();
bool InPreprocessorDirective = false;
Token TheTok;
Token IfStartTok;

View File

@ -0,0 +1,6 @@

@interface I2
@end
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_FAILONERROR=1 \
// RUN: c-index-test -test-load-source-reparse 1 local %s