From: Douglas Gregor <dgregor@apple.com> Date: Wed, 25 Aug 2010 18:04:15 +0000 (+0000) Subject: Fix an off-by-one error when computing the precompiled preamble for X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9c29a8d7a0f78ddf2b393dd92f77c7f2046179c;p=clang Fix an off-by-one error when computing the precompiled preamble for code completion. We were allowing the preamble to include the line that we're code-completing on. Again, testcase is forthcoming. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112064 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 16aa6e3cc0..fe460bb644 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -1797,7 +1797,8 @@ void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column, if (const FileStatus *MainStatus = MainPath.getFileStatus()) if (CompleteFileStatus->getUniqueID() == MainStatus->getUniqueID()) OverrideMainBuffer - = getMainBufferWithPrecompiledPreamble(CCInvocation, false, Line); + = getMainBufferWithPrecompiledPreamble(CCInvocation, false, + Line - 1); } // If the main file has been overridden due to the use of a preamble,