diff options
author | Ben Hamilton <benhamilton@google.com> | 2018-04-05 15:26:25 +0000 |
---|---|---|
committer | Ben Hamilton <benhamilton@google.com> | 2018-04-05 15:26:25 +0000 |
commit | 1462e8440f429d61d48f3161f89e5f3336d45dfc (patch) | |
tree | f8e46999e3e12189de706e4b96d3b67cc70046c3 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | f90ad9cdac9edc7f3b4268681d5d7ff2532565cc (diff) | |
download | bcm5719-llvm-1462e8440f429d61d48f3161f89e5f3336d45dfc.tar.gz bcm5719-llvm-1462e8440f429d61d48f3161f89e5f3336d45dfc.zip |
[clang-format] Support lightweight Objective-C generics
Summary:
Previously, `clang-format` didn't understand lightweight
Objective-C generics, which have the form:
```
@interface Foo <KeyType,
ValueTypeWithConstraint : Foo,
AnotherValueTypeWithGenericConstraint: Bar<Baz>, ... > ...
```
The lightweight generic specifier list appears before the base
class, if present, but because it starts with < like the protocol
specifier list, `UnwrappedLineParser` was getting confused and
failed to parse interfaces with both generics and protocol lists:
```
@interface Foo <KeyType> : NSObject <NSCopying>
```
Since the parsed line would be incomplete, the format result
would be very confused (e.g., https://bugs.llvm.org/show_bug.cgi?id=24381).
This fixes the issue by explicitly parsing the ObjC lightweight
generic conformance list, so the line is fully parsed.
Fixes: https://bugs.llvm.org/show_bug.cgi?id=24381
Test Plan: New tests added. Ran tests with:
% make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewers: djasper, jolesiak
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D45185
llvm-svn: 329298
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions