diff options
author | Krasimir Georgiev <krasimir@google.com> | 2017-10-30 14:01:50 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2017-10-30 14:01:50 +0000 |
commit | 9ad83fe7f64dbb7f2bebafa8e9b7637f98de8c8d (patch) | |
tree | 872a89f5225814bbfa0b4000f9f638f49c962f79 /clang/lib/Format/UnwrappedLineParser.cpp | |
parent | 5cde1ccb2998fe06e3930c1d5a8f3c4fb93e845d (diff) | |
download | bcm5719-llvm-9ad83fe7f64dbb7f2bebafa8e9b7637f98de8c8d.tar.gz bcm5719-llvm-9ad83fe7f64dbb7f2bebafa8e9b7637f98de8c8d.zip |
[clang-format] Format raw string literals
Summary:
This patch adds raw string literal formatting.
Reviewers: djasper, klimek
Reviewed By: klimek
Subscribers: klimek, mgorny
Differential Revision: https://reviews.llvm.org/D35943
llvm-svn: 316903
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index e210beb20e6..9243cd99cbb 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -225,6 +225,7 @@ private: UnwrappedLineParser::UnwrappedLineParser(const FormatStyle &Style, const AdditionalKeywords &Keywords, + unsigned FirstStartColumn, ArrayRef<FormatToken *> Tokens, UnwrappedLineConsumer &Callback) : Line(new UnwrappedLine), MustBreakBeforeNextToken(false), @@ -232,7 +233,7 @@ UnwrappedLineParser::UnwrappedLineParser(const FormatStyle &Style, CommentPragmasRegex(Style.CommentPragmas), Tokens(nullptr), Callback(Callback), AllTokens(Tokens), PPBranchLevel(-1), IfNdefCondition(nullptr), FoundIncludeGuardStart(false), - IncludeGuardRejected(false) {} + IncludeGuardRejected(false), FirstStartColumn(FirstStartColumn) {} void UnwrappedLineParser::reset() { PPBranchLevel = -1; @@ -247,10 +248,12 @@ void UnwrappedLineParser::reset() { CurrentLines = &Lines; DeclarationScopeStack.clear(); PPStack.clear(); + Line->FirstStartColumn = FirstStartColumn; } void UnwrappedLineParser::parse() { IndexedTokenSource TokenSource(AllTokens); + Line->FirstStartColumn = FirstStartColumn; do { DEBUG(llvm::dbgs() << "----\n"); reset(); @@ -2193,7 +2196,8 @@ void UnwrappedLineParser::parseJavaScriptEs6ImportExport() { LLVM_ATTRIBUTE_UNUSED static void printDebugInfo(const UnwrappedLine &Line, StringRef Prefix = "") { - llvm::dbgs() << Prefix << "Line(" << Line.Level << ")" + llvm::dbgs() << Prefix << "Line(" << Line.Level + << ", FSC=" << Line.FirstStartColumn << ")" << (Line.InPPDirective ? " MACRO" : "") << ": "; for (std::list<UnwrappedLineNode>::const_iterator I = Line.Tokens.begin(), E = Line.Tokens.end(); @@ -2226,6 +2230,7 @@ void UnwrappedLineParser::addUnwrappedLine() { CurrentLines->push_back(std::move(*Line)); Line->Tokens.clear(); Line->MatchingOpeningBlockLineIndex = UnwrappedLine::kInvalidIndex; + Line->FirstStartColumn = 0; if (CurrentLines == &Lines && !PreprocessorDirectives.empty()) { CurrentLines->append( std::make_move_iterator(PreprocessorDirectives.begin()), |