From 100ffc632aa1f9d21ffe2cb66dba6afb59b579f6 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 21 Aug 2015 11:44:57 +0000 Subject: clang-format: Be more conservative about specially indenting blocks in C++. This is a bit of a step back of what we did in r222531, as there are some corner cases in C++, where this kind of formatting is really bad. Example: Before: virtual aaaaaaaaaaaaaaaa(std::function IsKindWeWant = [&]() { return true; }, aaaaa aaaaaaaaa); After: virtual aaaaaaaaaaaaaaaa(std::function IsKindWeWant = [&]() { return true; }, aaaaa aaaaaaaaa); The block formatting logic in JavaScript will probably go some other changes, too, and we'll potentially be able to make the rules more consistent again. For now, this seems to be the best approach for C++. llvm-svn: 245694 --- clang/lib/Format/TokenAnnotator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Format/TokenAnnotator.cpp') diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 26d358267b9..381433484de 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2245,7 +2245,7 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, Left.is(tok::kw_operator)) return false; if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && - Line.Type == LT_VirtualFunctionDecl) + Line.Type == LT_VirtualFunctionDecl && Left.NestingLevel == 0) return false; if (Left.is(tok::l_paren) && Left.is(TT_AttributeParen)) return false; -- cgit v1.2.3