This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] [PR43338] C# clang format has space issues betweern C# only keywords
ClosedPublic

Authored by MyDeveloperDay on Sep 17 2019, 7:50 AM.

Details

Summary

When formatting C# there can be issues with a lack of spaces between using ( , foreach ( and generic types

The C# code

public class Foo
{
    Dictionary<string,string> foo;
}

will be formatted as

public class Foo
{
    Dictionary<string, string>foo;
                           ^^^^^   missing a space
}

This revision also reverts some of D66662: [clang-format] [PR43100] clang-format C# support does not add a space between "using" and paren in order to make this cleaner and resolve an issues seen by @owenpan that the formatting didn't add a space when not in a code block

This also transforms C# foreach commands to be seen as tok::kw_for commands (to ensure foreach gets the same Brace Wrapping behavior as for without littering the code with if(Style.isCSharp())

Diff Detail

Repository
rL LLVM

Event Timeline

MyDeveloperDay created this revision.Sep 17 2019, 7:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 17 2019, 7:50 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MyDeveloperDay retitled this revision from [clang-format] to [clang-format] [PR43338] C# clang format has space issues betweern C# only keywords.Sep 17 2019, 7:53 AM
MyDeveloperDay edited the summary of this revision. (Show Details)
MyDeveloperDay edited the summary of this revision. (Show Details)Sep 17 2019, 7:56 AM
MyDeveloperDay added a project: Restricted Project.Sep 25 2019, 1:16 AM
This revision is now accepted and ready to land.Oct 3 2019, 11:48 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2019, 1:11 AM