diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-04 03:32:04 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-04 03:32:04 +0000 |
commit | a3deaeeb52acdc863ee98eb5bb20b419518bc592 (patch) | |
tree | 8fdb5366843aa16255db9672562976d83ca98c98 /clang/lib/Frontend/ASTUnit.cpp | |
parent | 09ade9bb8b73587234b1703225beb9b4eed32cd0 (diff) | |
download | bcm5719-llvm-a3deaeeb52acdc863ee98eb5bb20b419518bc592.tar.gz bcm5719-llvm-a3deaeeb52acdc863ee98eb5bb20b419518bc592.zip |
Fix Lexer::ComputePreamble when MaxLines parameter is non-zero.
The function was only counting lines that included tokens and not empty lines,
but MaxLines (mainly initiated to the line where the code-completion point resides)
is a count of overall lines (even empty ones).
llvm-svn: 139085
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index b8551e9a420..190bc49a85f 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -2254,7 +2254,8 @@ void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column, llvm::sys::PathWithStatus MainPath(OriginalSourceFile); if (const FileStatus *CompleteFileStatus = CompleteFilePath.getFileStatus()) if (const FileStatus *MainStatus = MainPath.getFileStatus()) - if (CompleteFileStatus->getUniqueID() == MainStatus->getUniqueID()) + if (CompleteFileStatus->getUniqueID() == MainStatus->getUniqueID() && + Line > 1) OverrideMainBuffer = getMainBufferWithPrecompiledPreamble(*CCInvocation, false, Line - 1); |