[PATCH] D117416: [clang-format] Handle C variables with name that matches c++ access specifier
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 16 01:52:34 PST 2022
MyDeveloperDay requested changes to this revision.
MyDeveloperDay added inline comments.
This revision now requires changes to proceed.
================
Comment at: .arclint:5
"type": "script-and-regex",
- "script-and-regex.script": "bash utils/arcanist/clang-format.sh",
+ "script-and-regex.script": "cmd utils\\arcanist\\clang-format.sh",
"script-and-regex.regex": "/^(?P<severity>[[:alpha:]]+)\n(?P<message>[^\n]+)\n(====|(?P<line>\\d),(?P<char>\\d)\n(?P<original>.*)>>>>\n(?P<replacement>.*)<<<<\n)$/s",
----------------
remove this change
================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:103
return 0;
- if (RootToken.isAccessSpecifier(false) ||
+ if (RootToken.isAccessSpecifier(Style.Language == FormatStyle::LK_Cpp) ||
+ (RootToken.Next &&
----------------
Style.isCpp()
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2510
+ if (clang::format::OperatorsFollowingVar.find(FormatTok->Tok.getKind()) ==
+ OperatorsFollowingVar.end()) {
+ addUnwrappedLine();
----------------
elide `{`
================
Comment at: clang/unittests/Format/FormatTest.cpp:3034
+ // Var that looks like accessSpecifier
+ verifyFormat("private.p = 1;");
}
----------------
This isn't enough of a test, if you are going to add this `CppOperatorsFollowingVar` then you'd better test every case
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117416/new/
https://reviews.llvm.org/D117416
More information about the cfe-commits
mailing list