diff options
| author | Jacek Olesiak <jolesiak@google.com> | 2018-02-15 08:47:56 +0000 | 
|---|---|---|
| committer | Jacek Olesiak <jolesiak@google.com> | 2018-02-15 08:47:56 +0000 | 
| commit | ce4f0af3023fb3e023030d83998e3055545f13d0 (patch) | |
| tree | d27adb505f746f3296793e0a43d8dbb0f2089200 /clang/lib/Format | |
| parent | 7929d006d732185eee759aa84bb10d4150373b9f (diff) | |
| download | bcm5719-llvm-ce4f0af3023fb3e023030d83998e3055545f13d0.tar.gz bcm5719-llvm-ce4f0af3023fb3e023030d83998e3055545f13d0.zip  | |
[clang-format] Improve ObjC headers detection
Summary: Detect ObjC characteristic types when they start a line and add additional keywords.
Reviewers: benhamilton
Reviewed By: benhamilton
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43124
llvm-svn: 325221
Diffstat (limited to 'clang/lib/Format')
| -rw-r--r-- | clang/lib/Format/Format.cpp | 9 | 
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index ff437f119e9..af03696cf89 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1440,7 +1440,9 @@ private:          "NSAffineTransform",          "NSArray",          "NSAttributedString", +        "NSBundle",          "NSCache", +        "NSCalendar",          "NSCharacterSet",          "NSCountedSet",          "NSData", @@ -1466,6 +1468,7 @@ private:          "NSMutableString",          "NSNumber",          "NSNumberFormatter", +        "NSObject",          "NSOrderedSet",          "NSPoint",          "NSPointerArray", @@ -1475,17 +1478,19 @@ private:          "NSSet",          "NSSize",          "NSString", +        "NSTimeZone",          "NSUInteger",          "NSURL",          "NSURLComponents",          "NSURLQueryItem",          "NSUUID", +        "NSValue",      };      for (auto &Line : AnnotatedLines) { -      for (FormatToken *FormatTok = Line->First->Next; FormatTok; +      for (FormatToken *FormatTok = Line->First; FormatTok;             FormatTok = FormatTok->Next) { -        if ((FormatTok->Previous->is(tok::at) && +        if ((FormatTok->Previous && FormatTok->Previous->is(tok::at) &&               (FormatTok->isObjCAtKeyword(tok::objc_interface) ||                FormatTok->isObjCAtKeyword(tok::objc_implementation) ||                FormatTok->isObjCAtKeyword(tok::objc_protocol) ||  | 

