[PATCH] D76367: [clang-format] Handle C# generic type constraints
Krasimir Georgiev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 19 03:11:33 PDT 2020
krasimir requested changes to this revision.
krasimir added inline comments.
This revision now requires changes to proceed.
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:326
+void UnwrappedLineParser::parseCSharpGenericTypeConstraint(bool ConsumeBrace) {
+ do {
----------------
If you remove the reference from parseRecored (see comment there), consider removing the `ConsumeBrace` argument -- all other references set it to `false`.
We can add this later when we need it.
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2314
}
+ if (Style.isCSharp() && FormatTok->is(Keywords.kw_where)) {
+ addUnwrappedLine();
----------------
No tests fail if I remove this `if`.
Consider adding a test case for this or removing.
As this is the first in a series of patches, maybe we can add this in a later patch.
================
Comment at: clang/unittests/Format/FormatTestCSharp.cpp:631
verifyFormat(R"(Result this[Index x] => Foo(x);)", Style);
- verifyFormat(R"(class ItemFactory<T> where T : new() {})", Style);
----------------
consider moving this test case to the new `CSharpGenericTypeConstraints`, re-formatted (as I understand it, this patch forces a newline before the `while`).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76367/new/
https://reviews.llvm.org/D76367
More information about the cfe-commits
mailing list