Issue 96471
Summary [clang-format]Adding comments in ternary expressions results in absurd formatting
Labels clang-format
Assignees
Reporter EpicTroll897
    Found in version: 0.1.28

Code Snippet 1: Before applying clang-format:
```
    test = testA ? 100 :
               testB ? 200 : // this is a comment
 300;
```

Code Snippet 2: After applying clang-format (with comment):
```
    test = testA ? 100 : testB ? 200
 : // this is a comment
 300;
```

However, if the comment is removed from Code Snippet 1, the following result is obtained:

Code Snippet 3: After applying clang-format (without comment):
```
    test = testA ? 100 : testB ? 200
                                            : 300;
```

Note: Code Snippet 3 is still not properly indented, but that's an issue that's already been raised in other 'Issues' requests.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to