This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Improved identification of C# nullables
ClosedPublic

Authored by jbcoe on Mar 11 2020, 5:01 AM.

Details

Summary

Allow ? inside C# generics.

Do not mistake casts like (Type?) as conditional operators.

Diff Detail

Event Timeline

jbcoe created this revision.Mar 11 2020, 5:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2020, 5:01 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
krasimir added inline comments.Mar 11 2020, 5:44 AM
clang/lib/Format/TokenAnnotator.cpp
1016–1017

nit: add a space before and in the comment:

// ... `Type? name;`and ...
2976

nit: just replace the outer if body by:
return !Right.isOneOf(TT_TemplateCloser, tok::r_paren);

jbcoe edited the summary of this revision. (Show Details)Mar 11 2020, 5:51 AM
jbcoe updated this revision to Diff 249596.Mar 11 2020, 6:00 AM

Fix nits from review.

krasimir accepted this revision.Mar 11 2020, 6:03 AM

Thank you!

This revision is now accepted and ready to land.Mar 11 2020, 6:03 AM
This revision was automatically updated to reflect the committed changes.