[cfe-commits] r170566 - in /cfe/trunk: lib/AST/CommentParser.cpp test/Sema/warn-documentation-crlf.c

Dmitri Gribenko gribozavr at gmail.com
Wed Dec 19 09:34:56 PST 2012


Author: gribozavr
Date: Wed Dec 19 11:34:55 2012
New Revision: 170566

URL: http://llvm.org/viewvc/llvm-project?rev=170566&view=rev
Log:
Fix PR14591: Windows newlines in doxygen comments cause failed assertion in
TextDiagnostic

Patch by Janusz Chorko.

Added:
    cfe/trunk/test/Sema/warn-documentation-crlf.c
Modified:
    cfe/trunk/lib/AST/CommentParser.cpp

Modified: cfe/trunk/lib/AST/CommentParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentParser.cpp?rev=170566&r1=170565&r2=170566&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentParser.cpp (original)
+++ cfe/trunk/lib/AST/CommentParser.cpp Wed Dec 19 11:34:55 2012
@@ -175,8 +175,7 @@
     memcpy(TextPtr, WordText.c_str(), Length + 1);
     StringRef Text = StringRef(TextPtr, Length);
 
-    formTokenWithChars(Tok, Loc, WordBegin,
-                       Pos.BufferPtr - WordBegin, Text);
+    formTokenWithChars(Tok, Loc, WordBegin, Length, Text);
     return true;
   }
 

Added: cfe/trunk/test/Sema/warn-documentation-crlf.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation-crlf.c?rev=170566&view=auto
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation-crlf.c (added)
+++ cfe/trunk/test/Sema/warn-documentation-crlf.c Wed Dec 19 11:34:55 2012
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -Wdocumentation %s
+// The run line does not have '-verify' because we were crashing while printing
+// the diagnostic.
+
+// This file has DOS-style line endings (CR LF).  Please don't change it to
+// Unix-style LF!
+
+// PR14591.  Check that we don't crash on this.
+/**
+ * @param abc
+ */
+void nocrash1(int qwerty);
+





More information about the cfe-commits mailing list