summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorFrancois Ferrand <thetypz@gmail.com>2017-06-14 12:29:47 +0000
committerFrancois Ferrand <thetypz@gmail.com>2017-06-14 12:29:47 +0000
commite56a829e0980baaeb5c72ce84835cba8467d19fa (patch)
treeb3e94467f7646ffd0c7cef14f06e1bce97fe2019 /clang/lib/Format/UnwrappedLineParser.cpp
parent1680ea4c1f334cfc5e43cfea368c9bb9510810d1 (diff)
downloadbcm5719-llvm-e56a829e0980baaeb5c72ce84835cba8467d19fa.tar.gz
bcm5719-llvm-e56a829e0980baaeb5c72ce84835cba8467d19fa.zip
clang-format: Add CompactNamespaces option
Summary: Add CompactNamespaces option, to pack namespace declarations on the same line (somewhat similar to C++17 nested namespace definition). With this option, consecutive namespace declarations are kept on the same line: namespace foo { namespace bar { ... }} // namespace foo::bar Reviewers: krasimir, djasper, klimek Reviewed By: djasper Subscribers: kimgr, cfe-commits, klimek Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32480 llvm-svn: 305384
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index eda7ef36434..27436dda67a 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -492,6 +492,11 @@ void UnwrappedLineParser::parseBlock(bool MustBeDeclaration, bool AddLevel,
nextToken();
Line->Level = InitialLevel;
Line->MatchingOpeningBlockLineIndex = OpeningLineIndex;
+ if (OpeningLineIndex != UnwrappedLine::kInvalidIndex) {
+ // Update the opening line to add the forward reference as well
+ (*CurrentLines)[OpeningLineIndex].MatchingOpeningBlockLineIndex =
+ CurrentLines->size() - 1;
+ }
}
static bool isGoogScope(const UnwrappedLine &Line) {
OpenPOWER on IntegriCloud