From: Douglas Gregor Date: Tue, 8 Dec 2009 21:45:46 +0000 (+0000) Subject: Don't expand tabs when computing the offset from the code-completion column X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b760fe8fafde1d9d9f1f01db57a88cd9ce636342;p=clang 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 --- 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());