aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2012-12-19 17:34:55 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2012-12-19 17:34:55 +0000
commitca57ccdf480fc002202c74011bdf14687f164a5a (patch)
tree9be30d1c6db4950f2efcda8d72c7e9868fa49588
parentd7ebf3eead93232af7c7f0d30385a1f4c890f904 (diff)
Fix PR14591: Windows newlines in doxygen comments cause failed assertion in
TextDiagnostic Patch by Janusz Chorko. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170566 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/CommentParser.cpp3
-rw-r--r--test/Sema/warn-documentation-crlf.c13
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/AST/CommentParser.cpp b/lib/AST/CommentParser.cpp
index 7113f140eb..a7ba013efc 100644
--- a/lib/AST/CommentParser.cpp
+++ b/lib/AST/CommentParser.cpp
@@ -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
index 0000000000..99c0714efa
--- /dev/null
+++ b/test/Sema/warn-documentation-crlf.c
@@ -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);
+