This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Fix C# nullable-related errors
ClosedPublic

Authored by exv on May 4 2021, 2:25 PM.

Details

Summary

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.

Diff Detail

Event Timeline

exv requested review of this revision.May 4 2021, 2:25 PM
exv created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2021, 2:25 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
exv added a project: Restricted Project.

You can add a parent revision so that this patch will be applied upon its parent.

curdeius accepted this revision.May 5 2021, 12:44 AM

LGTM pending CI.

clang/lib/Format/UnwrappedLineParser.cpp
2531

Nit when you're here.

This revision is now accepted and ready to land.May 5 2021, 12:44 AM
exv edited the summary of this revision. (Show Details)May 5 2021, 12:28 PM
exv updated this revision to Diff 343143.May 5 2021, 12:30 PM
exv marked an inline comment as done.
  • Incorporate curdeius's feedback
exv updated this revision to Diff 343180.May 5 2021, 1:54 PM

Rebase again in an attempt to fix CI

This revision was automatically updated to reflect the committed changes.