From 2f209ccfbe5e6b33088763b1e022ba876fb0f35c Mon Sep 17 00:00:00 2001 From: mydeveloperday Date: Fri, 20 Dec 2019 17:04:49 +0000 Subject: [clang-format] C# formatting a class with inheritance followed by an attribute specifier assume its a braces initializer Summary: https://bugs.llvm.org/show_bug.cgi?id=44340 The rule that prevents `... {} [[....]]` being treated as a braced initializer for C++ causes problems for C# with attributes, causing it to be incorrectly classified and then messing up the subsequent formatting. (see bug for details of formatting) Reviewers: mitchell-stellar, klimek, sammccall Reviewed By: mitchell-stellar Subscribers: cfe-commits Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D71769 --- clang/lib/Format/UnwrappedLineParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Format/UnwrappedLineParser.cpp') diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 1e27eab1e74..ead6b474320 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -466,7 +466,7 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) { (NextTok->is(tok::semi) && (!ExpectClassBody || LBraceStack.size() != 1)) || (NextTok->isBinaryOperator() && !NextIsObjCMethod); - if (NextTok->is(tok::l_square)) { + if (!Style.isCSharp() && NextTok->is(tok::l_square)) { // We can have an array subscript after a braced init // list, but C++11 attributes are expected after blocks. NextTok = Tokens->getNextToken(); -- cgit v1.2.3