[cfe-commits] r103913 - in /cfe/trunk: lib/Lex/Lexer.cpp test/CodeCompletion/truncation.c
Douglas Gregor
dgregor at apple.com
Sun May 16 13:45:43 PDT 2010
Thank you!
Sent from my iPhone
On May 16, 2010, at 12:54 PM, Chris Lattner <sabre at nondot.org> wrote:
> Author: lattner
> Date: Sun May 16 14:54:05 2010
> New Revision: 103913
>
> URL: http://llvm.org/viewvc/llvm-project?rev=103913&view=rev
> Log:
> when code completing inside a C-style block comment, don't emit errors about
> a missing */ since we truncated the file.
>
> This fixes rdar://7948776
>
> Modified:
> cfe/trunk/lib/Lex/Lexer.cpp
> cfe/trunk/test/CodeCompletion/truncation.c
>
> Modified: cfe/trunk/lib/Lex/Lexer.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=103913&r1=103912&r2=103913&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/Lexer.cpp (original)
> +++ cfe/trunk/lib/Lex/Lexer.cpp Sun May 16 14:54:05 2010
> @@ -1141,7 +1141,8 @@
> unsigned char C = getCharAndSize(CurPtr, CharSize);
> CurPtr += CharSize;
> if (C == 0 && CurPtr == BufferEnd+1) {
> - if (!isLexingRawMode())
> + if (!isLexingRawMode() &&
> + !PP->isCodeCompletionFile(FileLoc))
> Diag(BufferPtr, diag::err_unterminated_block_comment);
> --CurPtr;
>
> @@ -1224,7 +1225,7 @@
> Diag(CurPtr-1, diag::warn_nested_block_comment);
> }
> } else if (C == 0 && CurPtr == BufferEnd+1) {
> - if (!isLexingRawMode())
> + if (!isLexingRawMode() && !PP->isCodeCompletionFile(FileLoc))
> Diag(BufferPtr, diag::err_unterminated_block_comment);
> // Note: the user probably forgot a */. We could continue immediately
> // after the /*, but this would involve lexing a lot of what really is the
>
> Modified: cfe/trunk/test/CodeCompletion/truncation.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/truncation.c?rev=103913&r1=103912&r2=103913&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeCompletion/truncation.c (original)
> +++ cfe/trunk/test/CodeCompletion/truncation.c Sun May 16 14:54:05 2010
> @@ -2,6 +2,8 @@
>
> struct
>
> +/* foo */
> +
> // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s.h:4:8 -o - %s | FileCheck -check-prefix=CC1 %s
> // CHECK-CC1: X
> // CHECK-CC1-NEXT: Y
> @@ -9,3 +11,8 @@
> // CHECK-CC2: X
> // CHECK-CC2: Xa
> // CHECK-CC2: Y
> +
> +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:5:3 -o - %s | FileCheck -check-prefix=CC3 %s
> +// CHECK-CC3: X
> +// CHECK-CC3: Xa
> +// CHECK-CC3: Y
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list