[PATCH] D75983: [clang-format] Improved identification of C# nullables

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 11 05:44:23 PDT 2020


krasimir added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:1016
       if (Style.isCSharp()) {
-        // `Type? name;` and `Type? name =` can only be nullable types.
+        // `Type?)`, `Type?>`, `Type? name;`and `Type? name =` can only be
+        // nullable types.
----------------
nit: add a space before `and` in the comment:
```
// ... `Type? name;`and ...
```


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2967
+    if (Left.is(TT_CSharpNullable)) {
+      if (Right.isOneOf(TT_TemplateCloser, tok::r_paren))
+        return false;
----------------
nit: just replace the outer if body by:
`return !Right.isOneOf(TT_TemplateCloser, tok::r_paren);`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75983/new/

https://reviews.llvm.org/D75983





More information about the cfe-commits mailing list