]> granicus.if.org Git - clang/commit
[clang-format] [PR43338] C# clang format has space issues betweern C# only keywords
authorPaul Hoad <mydeveloperday@gmail.com>
Fri, 4 Oct 2019 08:10:22 +0000 (08:10 +0000)
committerPaul Hoad <mydeveloperday@gmail.com>
Fri, 4 Oct 2019 08:10:22 +0000 (08:10 +0000)
commit60bc7b5041dea8c21f8735b86152dc3dbc0b5519
tree928f88ec872f08815d6e207bbab84a846415b298
parent0884008c1c877510735e7441f2a08d8c9c52cae0
[clang-format] [PR43338] C# clang format has space issues betweern C# only keywords

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} 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())`

Reviewers: owenpan, klimek, russellmcc, mitchell-stellar

Reviewed By: mitchell-stellar

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D67660

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373709 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/FormatTokenLexer.cpp
lib/Format/FormatTokenLexer.h
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestCSharp.cpp