]> granicus.if.org Git - clang/commitdiff
Fix PR14591: Windows newlines in doxygen comments cause failed assertion in
authorDmitri Gribenko <gribozavr@gmail.com>
Wed, 19 Dec 2012 17:34:55 +0000 (17:34 +0000)
committerDmitri Gribenko <gribozavr@gmail.com>
Wed, 19 Dec 2012 17:34:55 +0000 (17:34 +0000)
TextDiagnostic

Patch by Janusz Chorko.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170566 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/CommentParser.cpp
test/Sema/warn-documentation-crlf.c [new file with mode: 0644]

index 7113f140eb716a4236f5f321286ae489f9d0d23a..a7ba013efccc18be97dc0ce3f76fcb7ad2af34af 100644 (file)
@@ -175,8 +175,7 @@ public:
     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;
   }
 
diff --git a/test/Sema/warn-documentation-crlf.c b/test/Sema/warn-documentation-crlf.c
new file mode 100644 (file)
index 0000000..99c0714
--- /dev/null
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -Wdocumentation %s\r
+// The run line does not have '-verify' because we were crashing while printing\r
+// the diagnostic.\r
+\r
+// This file has DOS-style line endings (CR LF).  Please don't change it to\r
+// Unix-style LF!\r
+\r
+// PR14591.  Check that we don't crash on this.\r
+/**\r
+ * @param abc\r
+ */\r
+void nocrash1(int qwerty);\r
+\r