Go to file
Ben Hamilton 01cbd5aa68 [clang-format] Do not break after ObjC category open paren
Summary:
Previously, `clang-format` would break Objective-C
category extensions after the opening parenthesis to avoid
breaking the protocol list:

```
% echo "@interface ccccccccccccc (ccccccccccc) <ccccccccccccc> { }" | \
  clang-format -assume-filename=foo.h -style="{BasedOnStyle: llvm, \
  ColumnLimit: 40}"
@interface ccccccccccccc (
    ccccccccccc) <ccccccccccccc> {
}
```

This looks fairly odd, as we could have kept the category extension
on the previous line.

Category extensions are a single item, so they are generally very
short compared to protocol lists. We should prefer breaking after the
opening `<` of the protocol list over breaking after the opening `(`
of the category extension.

With this diff, we now avoid breaking after the category extension's
open paren, which causes us to break after the protocol list's
open angle bracket:

```
% echo "@interface ccccccccccccc (ccccccccccc) <ccccccccccccc> { }" | \
  ./bin/clang-format -assume-filename=foo.h -style="{BasedOnStyle: llvm, \
  ColumnLimit: 40}"
@interface ccccccccccccc (ccccccccccc) <
    ccccccccccccc> {
}
```

Test Plan: New test added. Confirmed test failed before diff and
  passed after diff by running:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 329919
2018-04-12 15:11:55 +00:00
clang [clang-format] Do not break after ObjC category open paren 2018-04-12 15:11:55 +00:00
clang-tools-extra [clang-tidy] readability-function-size: add VariableThreshold param. 2018-04-12 12:06:42 +00:00
compiler-rt [sanitizer] Correct name length computation for some Fuchsia vmos 2018-04-11 18:55:26 +00:00
debuginfo-tests [Darwin] Specify DWARF 2/4 when running apple accelerator tests. 2018-02-26 20:56:45 +00:00
libclc hypot: Port from amd builtins 2018-04-10 00:11:58 +00:00
libcxx [libcxx] Set ABI version 2 as default for Fuchsia 2018-04-11 01:06:28 +00:00
libcxxabi [CFI] Disable CFI checks for __cxa_decrement_exception_refcount 2018-04-09 22:11:28 +00:00
libunwind [cmake] Remove duplicate command line options from build 2018-04-05 20:27:50 +00:00
lld Remove references to old SymbolBody class 2018-04-11 19:52:53 +00:00
lldb Revert "Don't assume backing thread shares protocol ID." 2018-04-12 10:51:52 +00:00
llgo
llvm [Pipeliner] Use std::stable_sort when ordering NodeSets 2018-04-12 15:11:11 +00:00
openmp [OpenMP] Remove extra warning when we build 2018-04-10 15:28:31 +00:00
parallel-libs
polly Add isl operator overloads for isl::pw_aff (Try II) 2018-04-12 06:15:17 +00:00
README.md

README.md

Low Level Virtual Machine (LLVM)

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.