[PATCH] D103589: [Format] Fix incorrect pointer detection
Marek Kurdej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 4 00:39:31 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG21c18d5a0431: [Format] Fix incorrect pointer detection (authored by Nuullll, committed by curdeius).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103589/new/
https://reviews.llvm.org/D103589
Files:
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp
Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8706,6 +8706,7 @@
verifyIndependentOfContext("MACRO('0' <= c && c <= '9');");
verifyFormat("void f() { f(float{1}, a * a); }");
+ verifyFormat("void f() { f(float(1), a * a); }");
// FIXME: Is there a way to make this work?
// verifyIndependentOfContext("MACRO(A *a);");
verifyFormat("MACRO(A &B);");
Index: clang/lib/Format/TokenAnnotator.cpp
===================================================================
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -399,7 +399,7 @@
HasMultipleParametersOnALine = true;
if ((CurrentToken->Previous->isOneOf(tok::kw_const, tok::kw_auto) ||
CurrentToken->Previous->isSimpleTypeSpecifier()) &&
- !CurrentToken->is(tok::l_brace))
+ !CurrentToken->isOneOf(tok::l_brace, tok::l_paren))
Contexts.back().IsExpression = false;
if (CurrentToken->isOneOf(tok::semi, tok::colon)) {
MightBeObjCForRangeLoop = false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103589.349778.patch
Type: text/x-patch
Size: 1172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210604/3da9ed05/attachment.bin>
More information about the cfe-commits
mailing list