From c9c29a8d7a0f78ddf2b393dd92f77c7f2046179c Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 25 Aug 2010 18:04:15 +0000 Subject: 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 --- lib/Frontend/ASTUnit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/Frontend/ASTUnit.cpp') 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, -- cgit v1.2.3-18-g5258