]> granicus.if.org Git - clang/commitdiff
Fix an off-by-one error when computing the precompiled preamble for
authorDouglas Gregor <dgregor@apple.com>
Wed, 25 Aug 2010 18:04:15 +0000 (18:04 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 25 Aug 2010 18:04:15 +0000 (18:04 +0000)
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

index 16aa6e3cc0109bfe4da4f37a110bb8d445df1890..fe460bb6443dd8ef6064dd229d1657ca2c9b6e59 100644 (file)
@@ -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,