summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-12-14 20:47:11 +0000
committerAlexander Kornienko <alexfh@google.com>2014-12-14 20:47:11 +0000
commit732b6bd4d13c3dacf6cd189b56a0902377ad4f7c (patch)
tree8e1777cfadece6579a991a063fccd777d697f975 /clang/lib/Format/ContinuationIndenter.cpp
parentc4fbfee4ffcca42b272558252954a6421226d7fd (diff)
downloadbcm5719-llvm-732b6bd4d13c3dacf6cd189b56a0902377ad4f7c.tar.gz
bcm5719-llvm-732b6bd4d13c3dacf6cd189b56a0902377ad4f7c.zip
Don't break single-line raw string literals.
Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6636 llvm-svn: 224223
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp21
1 files changed, 1 insertions, 20 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index af4e1735dbf..b50a9a9a127 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -902,24 +902,6 @@ unsigned ContinuationIndenter::addMultilineToken(const FormatToken &Current,
return 0;
}
-static bool getRawStringLiteralPrefixPostfix(StringRef Text, StringRef &Prefix,
- StringRef &Postfix) {
- if (Text.startswith(Prefix = "R\"") || Text.startswith(Prefix = "uR\"") ||
- Text.startswith(Prefix = "UR\"") || Text.startswith(Prefix = "u8R\"") ||
- Text.startswith(Prefix = "LR\"")) {
- size_t ParenPos = Text.find('(');
- if (ParenPos != StringRef::npos) {
- StringRef Delimiter =
- Text.substr(Prefix.size(), ParenPos - Prefix.size());
- Prefix = Text.substr(0, ParenPos + 1);
- Postfix = Text.substr(Text.size() - 2 - Delimiter.size());
- return Postfix.front() == ')' && Postfix.back() == '"' &&
- Postfix.substr(1).startswith(Delimiter);
- }
- }
- return false;
-}
-
unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current,
LineState &State,
bool DryRun) {
@@ -977,8 +959,7 @@ unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current,
Text.startswith(Prefix = "u\"") || Text.startswith(Prefix = "U\"") ||
Text.startswith(Prefix = "u8\"") ||
Text.startswith(Prefix = "L\""))) ||
- (Text.startswith(Prefix = "_T(\"") && Text.endswith(Postfix = "\")")) ||
- getRawStringLiteralPrefixPostfix(Text, Prefix, Postfix)) {
+ (Text.startswith(Prefix = "_T(\"") && Text.endswith(Postfix = "\")"))) {
Token.reset(new BreakableStringLiteral(
Current, State.Line->Level, StartColumn, Prefix, Postfix,
State.Line->InPPDirective, Encoding, Style));
OpenPOWER on IntegriCloud