[PATCH] D101860: [clang-format] Fix C# nullable-related errors

Eliza Velasquez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 4 14:25:57 PDT 2021


exv created this revision.
exv requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This diff is based on https://reviews.llvm.org/D101702.

This fixes two errors:

Previously, clang-format was splitting up type identifiers from the
nullable ?. This changes this behavior so that the type name sticks with
the operator.

Additionally, nullable operators attached to return types in interface
functions were not parsed correctly. Digging deeper, it looks like
interface bodies were being parsed differently than classes and structs,
causing MustBeDeclaration to be incorrect for interface members. They
now share the same logic.

One other change is reintroducing the CSharpNullable type independent of
JsTypeOptionalQuestion. Despite having a similar semantic purpose, their
actual syntax differs quite a bit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101860

Files:
  clang/lib/Format/FormatToken.h
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/lib/Format/UnwrappedLineParser.h
  clang/unittests/Format/FormatTestCSharp.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101860.342868.patch
Type: text/x-patch
Size: 5111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210504/5f84d3af/attachment.bin>


More information about the cfe-commits mailing list