From b760fe8fafde1d9d9f1f01db57a88cd9ce636342 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 8 Dec 2009 21:45:46 +0000 Subject: [PATCH] Don't expand tabs when computing the offset from the code-completion column git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90881 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/Preprocessor.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 49a25f2574..0c1b858c45 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -221,16 +221,10 @@ bool Preprocessor::SetCodeCompletionPoint(const FileEntry *File, } } - for (unsigned Column = 1; Column < TruncateAtColumn; ++Column, ++Position) { - if (!*Position) - break; - - if (*Position == '\t') - Column += 7; - } + Position += TruncateAtColumn - 1; // Truncate the buffer. - if (Position != Buffer->getBufferEnd()) { + if (Position < Buffer->getBufferEnd()) { MemoryBuffer *TruncatedBuffer = MemoryBuffer::getMemBufferCopy(Buffer->getBufferStart(), Position, Buffer->getBufferIdentifier()); -- 2.50.1