]> granicus.if.org Git - clang/commitdiff
Don't expand tabs when computing the offset from the code-completion column
authorDouglas Gregor <dgregor@apple.com>
Tue, 8 Dec 2009 21:45:46 +0000 (21:45 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 8 Dec 2009 21:45:46 +0000 (21:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90881 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Preprocessor.cpp

index 49a25f25746918b689e506bb531e5bc3adb26be6..0c1b858c45d55d20d0d1918d9517bda96d05316b 100644 (file)
@@ -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());