[llvm-branch-commits] [cfe-branch] r105185 - in /cfe/branches/Apple/whitney: lib/Lex/Lexer.cpp test/Index/complete-exprs.c
Daniel Dunbar
daniel at zuster.org
Sun May 30 16:40:59 PDT 2010
Author: ddunbar
Date: Sun May 30 18:40:59 2010
New Revision: 105185
URL: http://llvm.org/viewvc/llvm-project?rev=105185&view=rev
Log:
Merge r105181:
--
Author: Douglas Gregor <dgregor at apple.com>
Date: Sun May 30 22:59:50 2010 +0000
Improve our handling of NULL after an escaping '' in a string
literal. Fixes <rdar://problem/8044135>.
Modified:
cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp
cfe/branches/Apple/whitney/test/Index/complete-exprs.c
Modified: cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp?rev=105185&r1=105184&r2=105185&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Lex/Lexer.cpp Sun May 30 18:40:59 2010
@@ -753,11 +753,15 @@
char C = getAndAdvanceChar(CurPtr, Result);
while (C != '"') {
// Skip escaped characters.
+ bool Escaped = false;
if (C == '\\') {
// Skip the escaped character.
C = getAndAdvanceChar(CurPtr, Result);
- } else if (C == '\n' || C == '\r' || // Newline.
- (C == 0 && CurPtr-1 == BufferEnd)) { // End of file.
+ Escaped = true;
+ }
+
+ if ((!Escaped && (C == '\n' || C == '\r')) || // Newline.
+ (C == 0 && CurPtr-1 == BufferEnd)) { // End of file.
if (!isLexingRawMode() && !Features.AsmPreprocessor)
Diag(BufferPtr, diag::err_unterminated_string);
FormTokenWithChars(Result, CurPtr-1, tok::unknown);
@@ -765,6 +769,7 @@
} else if (C == 0) {
NulCharacter = CurPtr-1;
}
+
C = getAndAdvanceChar(CurPtr, Result);
}
Modified: cfe/branches/Apple/whitney/test/Index/complete-exprs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/Index/complete-exprs.c?rev=105185&r1=105184&r2=105185&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/Index/complete-exprs.c (original)
+++ cfe/branches/Apple/whitney/test/Index/complete-exprs.c Sun May 30 18:40:59 2010
@@ -10,6 +10,8 @@
struct X f1 = { 17 };
void f2() { f1(17); }
+const char *str = "Hello, \nWorld";
+
// RUN: c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12)
@@ -35,3 +37,6 @@
// CHECK-CC4: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
// CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50)
+// RUN: c-index-test -code-completion-at=%s:13:28 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC5: NotImplemented:{TypedText void} (40)
+// CHECK-CC5: NotImplemented:{TypedText volatile} (40)
More information about the llvm-branch-commits
mailing list