[PATCH] D59546: [clang-format] structured binding in range for detected as Objective C
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 20 10:10:54 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rC356575: [clang-format] structured binding in range for detected as Objective C (authored by paulhoad, committed by ).
Herald added a project: clang.
Changed prior to commit:
https://reviews.llvm.org/D59546?vs=191288&id=191524#toc
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59546/new/
https://reviews.llvm.org/D59546
Files:
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp
Index: lib/Format/TokenAnnotator.cpp
===================================================================
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -410,7 +410,10 @@
Parent->isUnaryOperator() ||
// FIXME(bug 36976): ObjC return types shouldn't use TT_CastRParen.
Parent->isOneOf(TT_ObjCForIn, TT_CastRParen) ||
- getBinOpPrecedence(Parent->Tok.getKind(), true, true) > prec::Unknown);
+ // for (auto && [A,B] : C) && structure binding seen as ObjCMethodExpr
+ (Parent->isNot(tok::ampamp) &&
+ getBinOpPrecedence(Parent->Tok.getKind(), true, true) >
+ prec::Unknown));
bool ColonFound = false;
unsigned BindingIncrease = 1;
Index: unittests/Format/FormatTest.cpp
===================================================================
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -12926,6 +12926,9 @@
guessLanguage("foo.h", "[[using gsl: suppress(\"type\")]];"));
EXPECT_EQ(
FormatStyle::LK_Cpp,
+ guessLanguage("foo.h", "for (auto &&[endpoint, stream] : streams_)"));
+ EXPECT_EQ(
+ FormatStyle::LK_Cpp,
guessLanguage("foo.h",
"[[clang::callable_when(\"unconsumed\", \"unknown\")]]"));
EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", "[[foo::bar, ...]]"));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59546.191524.patch
Type: text/x-patch
Size: 1371 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190320/fdab747d/attachment.bin>
More information about the cfe-commits
mailing list