[PATCH] Support for CR LF newlines.
Daniel Jasper
djasper at google.com
Tue Sep 10 23:16:40 PDT 2013
No tests?
================
Comment at: lib/Format/Format.cpp:750
@@ -747,3 +749,3 @@
: Style(Style), Lex(Lex), SourceMgr(SourceMgr),
- Whitespaces(SourceMgr, Style), Ranges(Ranges),
- Encoding(encoding::detectEncoding(Lex.getBuffer())) {
+ Whitespaces(SourceMgr, Style, Lex.getBuffer().count('\r') * 2 >
+ Lex.getBuffer().count('\n')),
----------------
I think this functionally is both reasonably complex and expensive (linearly scans the entire code twice). IMO, it deserves are more visible location and a comment. Maybe just pass it in as additional parameter to the constructor.
================
Comment at: unittests/Format/FormatTest.cpp:119
@@ -118,3 +118,3 @@
EXPECT_EQ("int i;", format(" int i;"));
- EXPECT_EQ("\nint i;", format(" \n\t \r int i;"));
+ EXPECT_EQ("\nint i;", format(" \n\t \v \f int i;"));
EXPECT_EQ("int i;\nint j;", format(" int i; int j;"));
----------------
What happens with this test if you leave the \r?
http://llvm-reviews.chandlerc.com/D1643
More information about the cfe-commits
mailing list