[PATCH] Fix block comment parser

Rui Ueyama ruiu at google.com
Wed May 22 14:21:16 PDT 2013


  Forgot to hit the reply button...


================
Comment at: lib/Lex/Lexer.cpp:2120-2122
@@ -2108,4 +2119,5 @@
 
-    // This is the trigraph ending the comment.  Emit a stern warning!
-    CurPtr -= 2;
+  // Warn about having an escaped newline between the */ characters.
+  if (!L->isLexingRawMode())
+    L->Diag(CurPtr, diag::escaped_newline_block_comment_end);
 
----------------
Richard Smith wrote:
> We should only issue this diagnostic if we're treating the */ as the end of the comment; this should go after the diag::trigraph_ignored_block_comment bailout.
Ah, good point. Fixed.

================
Comment at: lib/Lex/Lexer.cpp:2099-2100
@@ +2098,4 @@
+    while (isHorizontalWhitespace(*CurPtr) || *CurPtr == 0) {
+      --CurPtr;
+      WhitespacePos = CurPtr;
+    }
----------------
Richard Smith wrote:
> Swap over these lines so the diagnostic points at the whitespace.
Done.


http://llvm-reviews.chandlerc.com/D777



More information about the llvm-commits mailing list