summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-08-29 17:32:57 +0000
committerAlexander Kornienko <alexfh@google.com>2013-08-29 17:32:57 +0000
commitd7b837e78d805ffee8bde8f0182bfe85c2841aeb (patch)
tree48e72068cde417110ef8b34914385dd979c24c9b /clang/lib/Format/Format.cpp
parent5533ec5c559bf8c9624916cccb148ed8d0d9494e (diff)
downloadbcm5719-llvm-d7b837e78d805ffee8bde8f0182bfe85c2841aeb.tar.gz
bcm5719-llvm-d7b837e78d805ffee8bde8f0182bfe85c2841aeb.zip
Better support for multiline string literals (including C++11 raw string literals).
Summary: Calculate characters in the first and the last line correctly so that we only break before the literal when needed. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D1544 llvm-svn: 189595
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 3c740d9d84c..84bf36c7fd2 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -596,8 +596,11 @@ private:
FormatTok->CodePointCount =
encoding::getCodePointCount(FormatTok->TokenText, Encoding);
- // FIXME: Add the CodePointCount to Column.
+ if (FormatTok->isOneOf(tok::string_literal, tok::comment) &&
+ FormatTok->TokenText.find('\n') != StringRef::npos)
+ FormatTok->IsMultiline = true;
+ // FIXME: Add the CodePointCount to Column.
FormatTok->WhitespaceRange = SourceRange(
WhitespaceStart, WhitespaceStart.getLocWithOffset(WhitespaceLength));
return FormatTok;
OpenPOWER on IntegriCloud