[PATCH] D41195: [ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style

2017-12-13 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: krasimir, djasper, klimek. Herald added a subscriber: cfe-commits. If we write the following code, it goes over 100 columns, so we need to wrap it: - (VeryLongReturnTypeName)veryLongMethodParameter:(VeryLongParameterName)thisIsAVery

[PATCH] D118921: [Format] Don't derive pointers right based on space before method ref-qualifiers

2022-02-03 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton requested changes to this revision. benhamilton added inline comments. This revision now requires changes to proceed. Comment at: clang/lib/Format/Format.cpp:1949 continue; +// Don't treat space in `void foo() &&` as evidence. +if (const aut

[PATCH] D118921: [Format] Don't derive pointers right based on space before method ref-qualifiers

2022-02-03 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton accepted this revision. benhamilton added a comment. This revision is now accepted and ready to land. Got it, thanks. Comment at: clang/lib/Format/Format.cpp:1949 continue; +// Don't treat space in `void foo() &&` as evidence. +if (const a

[PATCH] D89425: [Format/ObjC] Add NS_SWIFT_NAME() and CF_SWIFT_NAME() to WhitespaceSensitiveMacros

2020-10-14 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: sammccall, JakeMerdichAMD, curdeius. Herald added a project: clang. Herald added a subscriber: cfe-commits. benhamilton requested review of this revision. The argument passed to the preprocessor macros `NS_SWIFT_NAME(x)` and `CF_SWIFT

[PATCH] D89425: [Format/ObjC] Add NS_SWIFT_NAME() and CF_SWIFT_NAME() to WhitespaceSensitiveMacros

2020-10-14 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGe7b4feea8e1b: [Format/ObjC] Add NS_SWIFT_NAME() and CF_SWIFT_NAME() to… (authored by benhamilton). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89425/new/

[PATCH] D89496: [Format/ObjC] Correctly handle base class with lightweight generics and protocol

2020-10-15 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: sammccall, MyDeveloperDay. Herald added a project: clang. Herald added a subscriber: cfe-commits. benhamilton requested review of this revision. ClangFormat does not correctly handle an Objective-C interface declaration with both ligh

[PATCH] D89496: [Format/ObjC] Correctly handle base class with lightweight generics and protocol

2020-10-16 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG24b5266892c3: [Format/ObjC] Correctly handle base class with lightweight generics and protocol (authored by benhamilton). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews

[PATCH] D72876: Create a clang-tidy check to warn when -dealloc is implemented inside an ObjC class category.

2020-02-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton accepted this revision. benhamilton added a comment. LGTM, just one nit-pick. Comment at: clang-tools-extra/clang-tidy/objc/DeallocInCategoryCheck.h:24 +/// http://clang.llvm.org/extra/clang-tidy/checks/objc-dealloc-in-category.html +class DeallocInCategoryCheck : p

[PATCH] D72876: Create a clang-tidy check to warn when -dealloc is implemented inside an ObjC class category.

2020-02-10 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG0151ddc2e834: Create a clang-tidy check to warn when -dealloc is implemented inside an ObjC… (authored by mwyman, committed by benhamilton). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTI

[PATCH] D44692: [clang-format] Don't insert space between r_paren and 'new' in ObjC decl

2018-03-20 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak. Herald added subscribers: cfe-commits, klimek. Previously, clang-format would insert a space between the closing parenthesis and 'new' in the following valid Objective-C declaration: + (instancetype)new; This wa

[PATCH] D44695: [clang-format] Partially revert r322749, replacing array with DenseSet

2018-03-20 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. I'm fine with whichever approach we use, but I'll defer to @krasimir here. (I'm not fully sure why `llvm::DenseSet` is better than `std::unsorted_set`, but I'm sure you and @krasimir understand the subtleties better than I do.) Repository: rC Clang https://revie

[PATCH] D44695: [clang-format] Partially revert r322749, replacing array with DenseSet

2018-03-20 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > One way in which DenseSet is better is that it supports StringRefs - we don't > have to define hash. Seems like the lack of this override in core LLVM > suggests that unordered_set is not commonly used with StringRefs. Makes sense, thanks. Repository: rC Clang

[PATCH] D44539: [Sema][Objective-C] Add check to warn when property of objc type has assign attribute

2018-03-20 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. I think the problem is there are valid places to use assign on object types (especially delegates). There are a lot of special cases to deal with here, and it's really up to each team to decide the rules for when assign on object types are OK, so I don't think a co

[PATCH] D44539: [Sema][Objective-C] Add check to warn when property of objc type has assign attribute

2018-03-20 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > Isn't it better to have unsafe_unretained there? That is a good question for the author of that property attribute. I'm not sure of the entire history. Repository: rC Clang https://reviews.llvm.org/D44539 ___ cfe-

[PATCH] D44692: [clang-format] Don't insert space between r_paren and 'new' in ObjC decl

2018-03-21 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL328174: [clang-format] Don't insert space between r_paren and 'new' in ObjC decl (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.

[PATCH] D44632: [clang-format] Add a few more Core Graphics identifiers to ObjC heuristic

2018-03-21 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 139410. benhamilton marked an inline comment as done. benhamilton added a comment. Remove assert Repository: rC Clang https://reviews.llvm.org/D44632 Files: lib/Format/Format.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTes

[PATCH] D44632: [clang-format] Add a few more Core Graphics identifiers to ObjC heuristic

2018-03-21 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL328175: [clang-format] Add a few more Core Graphics identifiers to ObjC heuristic (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.

[PATCH] D44790: [clang-format] Fix ObjC style guesser to also iterate over child lines

2018-03-22 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak, Wizard. Herald added subscribers: cfe-commits, klimek. When I wrote `ObjCHeaderStyleGuesser`, I incorrectly assumed the correct way to iterate over all tokens in `AnnotatedLine` was to iterate over the linked list t

[PATCH] D44790: [clang-format] Fix ObjC style guesser to also iterate over child lines

2018-03-22 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 139471. benhamilton added a comment. CheckLineTokens -> LineContainsObjCCode Repository: rC Clang https://reviews.llvm.org/D44790 Files: lib/Format/Format.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTest.cpp ==

[PATCH] D44790: [clang-format] Fix ObjC style guesser to also iterate over child lines

2018-03-22 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton marked an inline comment as done. benhamilton added inline comments. Comment at: lib/Format/Format.cpp:1517 -for (auto &Line : AnnotatedLines) { - for (FormatToken *FormatTok = Line->First; FormatTok; +auto CheckLineTokens = [&Keywords](const AnnotatedL

[PATCH] D44790: [clang-format] Fix ObjC style guesser to also iterate over child lines

2018-03-22 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. benhamilton marked an inline comment as done. Closed by commit rL328220: [clang-format] Fix ObjC style guesser to also iterate over child lines (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commit

[PATCH] D44816: [clang-format] Do not insert space before closing brace in ObjC dict literal

2018-03-22 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak, Wizard. Herald added subscribers: cfe-commits, klimek. Previously, `clang-format` would sometimes insert a space before the closing brace in an Objective-C dictionary literal. Unlike array literals (which obey `Sty

[PATCH] D44790: [clang-format] Fix ObjC style guesser to also iterate over child lines

2018-03-23 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: cfe/trunk/lib/Format/Format.cpp:1544 +return true; + for (auto ChildLine : Line->Children) { +if (LineContainsObjCCode(*ChildLine)) djasper wrote: > Sorry that I missed this in the original revie

[PATCH] D44831: [clang-format] Refine ObjC guesser to handle child lines of child lines

2018-03-23 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added a reviewer: djasper. Herald added subscribers: cfe-commits, klimek. This fixes an issue brought up by djasper@ in his review of https://reviews.llvm.org/D44790. We handled top-level child lines, but if those child lines themselves had child lin

[PATCH] D44790: [clang-format] Fix ObjC style guesser to also iterate over child lines

2018-03-23 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton marked an inline comment as done. benhamilton added inline comments. Comment at: cfe/trunk/lib/Format/Format.cpp:1544 +return true; + for (auto ChildLine : Line->Children) { +if (LineContainsObjCCode(*ChildLine)) benhamilton wrote

[PATCH] D44831: [clang-format] Refine ObjC guesser to handle child lines of child lines

2018-03-23 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 139601. benhamilton added a comment. Update from correct base revision Repository: rC Clang https://reviews.llvm.org/D44831 Files: lib/Format/Format.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTest.cpp

[PATCH] D44831: [clang-format] Refine ObjC guesser to handle child lines of child lines

2018-03-26 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/Format.cpp:1542 }; -for (auto Line : AnnotatedLines) { - if (LineContainsObjCCode(*Line)) +llvm::DenseSet LinesToCheckSet; +LinesToCheckSet.reserve(AnnotatedLines.size()); djasper wro

[PATCH] D44831: [clang-format] Refine ObjC guesser to handle child lines of child lines

2018-03-26 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/Format.cpp:1542 }; -for (auto Line : AnnotatedLines) { - if (LineContainsObjCCode(*Line)) +llvm::DenseSet LinesToCheckSet; +LinesToCheckSet.reserve(AnnotatedLines.size()); benhamilton

[PATCH] D44831: [clang-format] Refine ObjC guesser to handle child lines of child lines

2018-03-26 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 139802. benhamilton added a comment. - Use recursion. Split lambda out into its own static method since recursion on lambdas is quite ugly until C++14 Repository: rC Clang https://reviews.llvm.org/D44831 Files: lib/Format/Format.cpp unittests/Fo

[PATCH] D44831: [clang-format] Refine ObjC guesser to handle child lines of child lines

2018-03-26 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 139804. benhamilton added a comment. - Remove stray semicolon. Repository: rC Clang https://reviews.llvm.org/D44831 Files: lib/Format/Format.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTest.cpp

[PATCH] D44831: [clang-format] Refine ObjC guesser to handle child lines of child lines

2018-03-27 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 139929. benhamilton marked 2 inline comments as done. benhamilton added a comment. - Simplify recursion. Remove static method LineContainsObjCCode(). Repository: rC Clang https://reviews.llvm.org/D44831 Files: lib/Format/Format.cpp unittests/Form

[PATCH] D44831: [clang-format] Refine ObjC guesser to handle child lines of child lines

2018-03-27 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/Format.cpp:1449 const AdditionalKeywords &Keywords) { +for (auto Line : AnnotatedLines) + if (LineContainsObjCCode(*Line, Keywords)) djasper wrote: > I would not create

[PATCH] D44816: [clang-format] Do not insert space before closing brace in ObjC dict literal

2018-03-27 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 139930. benhamilton marked an inline comment as done. benhamilton added a comment. - Use `Right.MatchingParen->endsSequence(TT_DictLiteral, tok::at)` Repository: rC Clang https://reviews.llvm.org/D44816 Files: lib/Format/TokenAnnotator.cpp unitte

[PATCH] D44816: [clang-format] Do not insert space before closing brace in ObjC dict literal

2018-03-27 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:2484 + if (Right.is(tok::r_brace) && Right.MatchingParen && + Right.MatchingParen->is(TT_DictLiteral) && + Right.MatchingParen->Previous && djasper wrote: > Could you use Righ

[PATCH] D44816: [clang-format] Do not insert space before closing brace in ObjC dict literal

2018-03-27 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. I filed https://bugs.llvm.org/show_bug.cgi?id=36919 to follow up and make ObjC dictionary literal spacing consistent with ObjC array literals. Repository: rC Clang https://reviews.llvm.org/D44816 ___ cfe-commits mail

[PATCH] D44816: [clang-format] Do not insert space before closing brace in ObjC dict literal

2018-03-27 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC328627: [clang-format] Do not insert space before closing brace in ObjC dict literal (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D44816?vs=139930&id=13993

[PATCH] D44831: [clang-format] Refine ObjC guesser to handle child lines of child lines

2018-03-27 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC328628: [clang-format] Refine ObjC guesser to handle child lines of child lines (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D44831?vs=139929&id=139932#toc

[PATCH] D44994: [clang-format] Ensure wrapped ObjC selectors with 1 arg obey IndentWrappedFunctionNames

2018-03-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, klimek, Typz. Herald added a subscriber: cfe-commits. benhamilton added a reviewer: jolesiak. In https://reviews.llvm.org/D43121, @Typz introduced logic to avoid indenting 2-or-more argument ObjC selectors too far to the rig

[PATCH] D44996: [clang-format] Ensure ObjC selectors with 0 args are annotated correctly

2018-03-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak. Herald added subscribers: cfe-commits, klimek. Previously, clang-format would incorrectly annotate 0-argument Objective-C selector names as TT_TrailingAnnotation: % echo "-(void)foo;" > /tmp/test.m % ./bin/clan

[PATCH] D45004: [clang-format] New style option IndentWrappedObjCMethodNames

2018-03-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak. Herald added subscribers: cfe-commits, klimek. Currently, indentation of Objective-C method names which are wrapped onto the next line due to a long return type is controlled by the style option `IndentWrappedFuncti

[PATCH] D45005: [clang-format] Set IndentWrappedObjCMethodNames to Always in google style

2018-03-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, klimek, jolesiak. Herald added a subscriber: cfe-commits. Now that we can separately control ObjC method name wrapping and non-ObjC function name wrapping, this diff sets `IndentWrappedObjCMethodNames` to `Always` for the Goo

[PATCH] D45004: [clang-format] New style option IndentWrappedObjCMethodNames

2018-03-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 140155. benhamilton added a comment. Fix typo Repository: rC Clang https://reviews.llvm.org/D45004 Files: include/clang/Format/Format.h lib/Format/ContinuationIndenter.cpp lib/Format/Format.cpp unittests/Format/FormatTestObjC.cpp Index: unit

[PATCH] D45004: [clang-format] New style option IndentWrappedObjCMethodNames

2018-03-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > What do you think of the name IndentWrappedObjCMethodSignatures as an > alternative to IndentWrappedObjCMethodNames? In Objective-C the method name > might be considered the selector whereas I believe that this option pertains > to formatting of the method signatu

[PATCH] D44994: [clang-format] Ensure wrapped ObjC selectors with 1 arg obey IndentWrappedFunctionNames

2018-03-29 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 140251. benhamilton marked 2 inline comments as done. benhamilton added a comment. @djasper comments Repository: rC Clang https://reviews.llvm.org/D44994 Files: lib/Format/ContinuationIndenter.cpp unittests/Format/FormatTestObjC.cpp Index: unit

[PATCH] D44994: [clang-format] Ensure wrapped ObjC selectors with 1 arg obey IndentWrappedFunctionNames

2018-03-29 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Thanks, applied your suggested change. Comment at: lib/Format/ContinuationIndenter.cpp:899 if (!State.Stack.back().ObjCSelectorNameFound) { + unsigned MinIndent = + (Style.IndentWrappedFunctionNames djasper wrote:

[PATCH] D44994: [clang-format] Ensure wrapped ObjC selectors with 1 arg obey IndentWrappedFunctionNames

2018-03-29 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 140252. benhamilton added a comment. One more tidy-up Repository: rC Clang https://reviews.llvm.org/D44994 Files: lib/Format/ContinuationIndenter.cpp unittests/Format/FormatTestObjC.cpp Index: unittests/Format/FormatTestObjC.cpp ===

[PATCH] D44996: [clang-format] Ensure ObjC selectors with 0 args are annotated correctly

2018-03-29 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 140259. benhamilton added a comment. @jolesiak Repository: rC Clang https://reviews.llvm.org/D44996 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestObjC.cpp Index: unittests/Format/FormatTestObjC.cpp

[PATCH] D44996: [clang-format] Ensure ObjC selectors with 0 args are annotated correctly

2018-03-29 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton marked 3 inline comments as done. benhamilton added inline comments. Comment at: unittests/Format/FormatTestObjC.cpp:527 + // Make sure selectors with 0, 1, or more arguments are not indented + // when IndentWrappedFunctionNames is false. + verifyFormat("- (aaa

[PATCH] D45004: [clang-format] New style option IndentWrappedObjCMethodNames

2018-03-29 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton marked an inline comment as done. benhamilton added inline comments. Comment at: include/clang/Format/Format.h:1154-1163 + /// \brief The style of indenting long function or method names wrapped + /// onto the next line. + enum IndentWrappedMethodStyle { +/// A

[PATCH] D45004: [clang-format] New style option IndentWrappedObjCMethodNames

2018-03-29 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton marked an inline comment as done. benhamilton added a comment. > Do we have a public style guide that explicitly says to do this? Good question! This was the result of internal discussion with the Google Objective-C style guide maintainers based on analysis of ObjC code at Google. I

[PATCH] D45004: [clang-format] New style option IndentWrappedObjCMethodNames

2018-03-29 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > Well, I disagree. It says: "If you break after the return type of a function > declaration or definition, do not indent." Great, thanks for clarifying! Repository: rC Clang https://reviews.llvm.org/D45004 ___ cfe-

[PATCH] D44994: [clang-format] Ensure wrapped ObjC selectors with 1 arg obey IndentWrappedFunctionNames

2018-03-29 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton marked an inline comment as done. benhamilton added inline comments. Comment at: lib/Format/ContinuationIndenter.cpp:904 + : State.Stack.back().Indent); if (NextNonComment->LongestObjCSelectorName == 0) +return MinIndent;

[PATCH] D44994: [clang-format] Ensure wrapped ObjC selectors with 1 arg obey IndentWrappedFunctionNames

2018-03-29 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 140271. benhamilton added a comment. Remove if (...) return MinIndent. Repository: rC Clang https://reviews.llvm.org/D44994 Files: lib/Format/ContinuationIndenter.cpp unittests/Format/FormatTestObjC.cpp Index: unittests/Format/FormatTestObjC.cp

[PATCH] D44996: [clang-format] Ensure ObjC selectors with 0 args are annotated correctly

2018-03-30 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:1347 +} else if (Current.isOneOf(tok::identifier, tok::kw_new) && + Current.Previous && Current.Previous->is(TT_CastRParen) && + Current.Previous->MatchingParen && ---

[PATCH] D44994: [clang-format] Ensure wrapped ObjC selectors with 1 arg obey IndentWrappedFunctionNames

2018-03-30 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC328871: [clang-format] Ensure wrapped ObjC selectors with 1 arg obey… (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D44994?vs=140271&id=140436#toc Reposito

[PATCH] D44994: [clang-format] Ensure wrapped ObjC selectors with 1 arg obey IndentWrappedFunctionNames

2018-03-30 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. benhamilton marked an inline comment as done. Closed by commit rL328871: [clang-format] Ensure wrapped ObjC selectors with 1 arg obey… (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Repos

[PATCH] D45168: [clang-format/ObjC] Do not insert space after opening brace of ObjC dict literal

2018-04-02 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak, krasimir. Herald added subscribers: cfe-commits, klimek. https://reviews.llvm.org/D44816 attempted to fix a few cases where `clang-format` incorrectly inserted a space before the closing brace of an Objective-C dic

[PATCH] D45169: [clang-format/ObjC] Do not detect "[]" as ObjC method expression

2018-04-02 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak. Herald added subscribers: cfe-commits, klimek. The following C++ code was being detected by `guessLanguage()` as Objective-C: #define FOO(...) auto bar = [] __VA_ARGS__; This was because `[] __VA_ARGS__` is not

[PATCH] D44996: [clang-format] Ensure ObjC selectors with 0 args are annotated correctly

2018-04-02 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton marked 2 inline comments as done. benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:1347 +} else if (Current.isOneOf(tok::identifier, tok::kw_new) && + Current.Previous && Current.Previous->is(TT_CastRParen) && +

[PATCH] D45185: [clang-format] Support lightweight Objective-C generics

2018-04-02 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak. Herald added subscribers: cfe-commits, klimek. Previously, `clang-format` didn't understand lightweight Objective-C generics, which have the form: @interface Foo , ... > ... The lightweight generic specifier lis

[PATCH] D45168: [clang-format/ObjC] Do not insert space after opening brace of ObjC dict literal

2018-04-03 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL329069: [clang-format/ObjC] Do not insert space after opening brace of ObjC dict literal (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https

[PATCH] D45169: [clang-format/ObjC] Do not detect "[]" as ObjC method expression

2018-04-03 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL329070: [clang-format/ObjC] Do not detect "[]" as ObjC method expression (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/

[PATCH] D45185: [clang-format] Support lightweight Objective-C generics

2018-04-04 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 140968. benhamilton marked 3 inline comments as done. benhamilton added a comment. - @djasper fixes Repository: rC Clang https://reviews.llvm.org/D45185 Files: lib/Format/UnwrappedLineParser.cpp unittests/Format/FormatTestObjC.cpp Index: unitte

[PATCH] D45185: [clang-format] Support lightweight Objective-C generics

2018-04-04 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Thanks, fixed! Comment at: lib/Format/UnwrappedLineParser.cpp:2135 +nextToken(); +if (FormatTok->Tok.is(tok::less)) + NumOpenAngles++; djasper wrote: > The UnwrappedLineParser is very much about error recovery. Implemen

[PATCH] D44996: [clang-format] Ensure ObjC selectors with 0 args are annotated correctly

2018-04-04 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton marked an inline comment as done. benhamilton added a comment. Any more comments on this one, folks? I'd love to land this fix. Repository: rC Clang https://reviews.llvm.org/D44996 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[PATCH] D45004: [clang-format] New style option IndentWrappedObjCMethodNames

2018-04-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > a user sets the existing IndentWrappedFunctionNames to true for ObjC and to > false for C++. > Now IMO, that should mean that ObjC function names are indented and C++ > functions are not, even if the language of the *file* is ObjC. > Getting this right will requ

[PATCH] D44996: [clang-format] Ensure ObjC selectors with 0 args are annotated correctly

2018-04-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 141161. benhamilton added a comment. Add FIXME comments. Repository: rC Clang https://reviews.llvm.org/D44996 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestObjC.cpp Index: unittests/Format/FormatTestObjC.cpp ==

[PATCH] D45185: [clang-format] Support lightweight Objective-C generics

2018-04-05 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC329298: [clang-format] Support lightweight Objective-C generics (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D45185?vs=140968&id=141163#toc Repository:

[PATCH] D44996: [clang-format] Ensure ObjC selectors with 0 args are annotated correctly

2018-04-05 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC329297: [clang-format] Ensure ObjC selectors with 0 args are annotated correctly (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D44996?vs=141161&id=141162#to

[PATCH] D45004: [clang-format] New style option IndentWrappedObjCMethodNames

2018-04-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > A FormatStyle already contains a reference to the FormatStyleSet it was > created from and you can get the FormatStyle for a different language through > that. It might just be a bit hacky and not easy to understand as is, but > maybe there are easy abstractions t

[PATCH] D45004: [clang-format] New style option IndentWrappedObjCMethodNames

2018-04-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Actually, a slight correction. By default, Xcode has a "Line wrapping" setting under Preferences -> Text editing which says: [ X ] Wrap lines to editor width Indent wrapped lines by: [4 ] Spaces which suggests people using Xcode may expect indentation

[PATCH] D45004: [clang-format] New style option IndentWrappedObjCMethodNames

2018-04-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > By default, Xcode has a "Line wrapping" setting Ah, that appears to just be a visual thing. Xcode doesn't actually insert newlines into the source code. Repository: rC Clang https://reviews.llvm.org/D45004 ___ cfe

[PATCH] D45004: [clang-format] Always indent wrapped Objective-C selector names

2018-04-10 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 141872. benhamilton added a comment. - Unconditionally indent wrapped ObjC selector names. - Partially revert r242484, as it was causing double-indenting (the tests still pass with it reverted, so I suspect it's no longer necessary). Repository: rC Cl

[PATCH] D45004: [clang-format] Always indent wrapped Objective-C selector names

2018-04-10 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > Ok, you know the ObjC community much better than I do. If you think that > adding the indentation for ObjC irrespective of the option works for most > people, I am happy to go with it. OK, I went ahead and implemented unconditional indenting of wrapped ObjC selec

[PATCH] D45005: [clang-format] Set IndentWrappedObjCMethodNames to Always in google style

2018-04-10 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton abandoned this revision. benhamilton added a comment. Abandoned in favor of unconditionally indenting wrapped ObjC selectors in https://reviews.llvm.org/D45004. Repository: rC Clang https://reviews.llvm.org/D45005 ___ cfe-commits mai

[PATCH] D45498: [clang-format] Don't insert space between ObjC class and lightweight generic

2018-04-10 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak. Herald added subscribers: cfe-commits, klimek. In https://reviews.llvm.org/D45185, I added clang-format parser support for Objective-C generics. However, I didn't touch the whitespace logic, so they got the same sp

[PATCH] D45521: [clang-format] Improve ObjC guessing heuristic by supporting all @keywords

2018-04-11 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak. Herald added subscribers: cfe-commits, klimek. This diff improves the Objective-C guessing heuristic by replacing the hard-coded list of a subset of Objective-C @keywords with a general check which supports all @key

[PATCH] D45526: [clang-format] Prefer breaking after ObjC category close paren

2018-04-11 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak. Herald added subscribers: cfe-commits, klimek. Previously, `clang-format` would break Objective-C category extensions after the opening parenthesis to avoid breaking the protocol list: % echo "@interface

[PATCH] D39829: add new check for property declaration

2017-11-09 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: docs/clang-tidy/checks/objc-property-declaration.rst:7 +Finds property declarations in Objective-C files that do not follow the pattern +of property names in Google's Objective-C Style Guide. The property name should +be in the forma

[PATCH] D39829: add new check for property declaration

2017-11-09 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:25 +/// we will do best effort to generate a fix, however, if the +/// case can not be solved with a simple fix (e.g. remove prefix or change first +/// character), we will leave the fix

[PATCH] D39829: add new check for property declaration

2017-11-10 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:41 + objcPropertyDecl( + // the property name should be in Lower Camel Case like + // 'lowerCamelCase' There are some exceptions we should special c

[PATCH] D39829: add new check for property declaration

2017-11-10 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:41 + objcPropertyDecl( + // the property name should be in Lower Camel Case like + // 'lowerCamelCase' benhamilton wrote: > There are some exception

[PATCH] D39829: add new check for property declaration

2017-11-13 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:89 + assert(MatchedDecl->getName().size() > 0); + // Skip the check of lowerCamelCase if the name has prefix of special acronyms + if (startsWithSpecialAcronyms(MatchedDecl->getName(),

[PATCH] D39829: add new check for property declaration

2017-11-13 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 122739. benhamilton added a comment. - Use regex to match acronym prefixes, update tests https://reviews.llvm.org/D39829 Files: clang-tidy/objc/CMakeLists.txt clang-tidy/objc/ObjCTidyModule.cpp clang-tidy/objc/PropertyDeclarationCheck.cpp clang-

[PATCH] D39829: add new check for property declaration

2017-11-13 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. OK, I updated this diff with the suggested changes. @Wizard, want to take a look before I land? https://reviews.llvm.org/D39829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailm

[PATCH] D39829: add new check for property declaration

2017-11-13 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL318117: add new check for property declaration (authored by benhamilton). Repository: rL LLVM https://reviews.llvm.org/D39829 Files: clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt clang-to

[PATCH] D40058: add check to avoid throwing objc exception according to Google Objective-C guide

2017-11-15 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton requested changes to this revision. benhamilton added a comment. This revision now requires changes to proceed. Almost there. Comment at: clang-tidy/google/AvoidThrowingObjcExceptionCheck.cpp:22 +void AvoidThrowingObjcExceptionCheck::registerMatchers(MatchFinder *Fi

[PATCH] D40058: add check to avoid throwing objc exception according to Google Objective-C guide

2017-11-15 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton accepted this revision. benhamilton added a comment. This revision is now accepted and ready to land. Looking good. Please rename the files correctly, or it will not build on Linux. Comment at: clang-tidy/google/AvoidThrowingObjcExceptionCheck.cpp:23 + Finder->addM

[PATCH] D40058: add check to avoid throwing objc exception according to Google Objective-C guide

2017-11-15 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: test/clang-tidy/google-objc-avoid-throwing-exception.m:17-20 +- (void)f2 { +[NSException raise:@"TestException" format:@"Test"]; +// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: pass in NSError ** instead of throwing exception

[PATCH] D40058: add check to avoid throwing objc exception according to Google Objective-C guide

2017-11-15 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: clang-tidy/google/AvoidThrowingObjcExceptionCheck.h:1 +//===--- AvoidThrowingObjCExceptionCheck.h - clang-tidy--*- C++ -*-===// +// benhamilton wrote: > Don't forget to rename the file to AvoidThrowingObjcEx

[PATCH] D40058: add check to avoid throwing objc exception according to Google Objective-C guide

2017-11-15 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. File names look good now, thanks. Comment at: clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp:1 +//===--- AvoidThrowingObjcExceptionCheck.cpp - clang-tidy--===// +// Objc -> ObjC https://reviews.llvm.org/D4

[PATCH] D40058: add check to avoid throwing objc exception according to Google Objective-C guide

2017-11-15 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton accepted this revision. benhamilton added a comment. LGTM https://reviews.llvm.org/D40058 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D40140: [VirtualFileSystem] Support creating directories then adding files inside

2017-11-16 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 123221. benhamilton added a comment. - Fix style. https://reviews.llvm.org/D40140 Files: include/clang/Basic/VirtualFileSystem.h lib/Basic/VirtualFileSystem.cpp unittests/Basic/VirtualFileSystemTest.cpp Index: unittests/Basic/VirtualFileSystemTe

[PATCH] D40140: [VirtualFileSystem] Support creating directories then adding files inside

2017-11-16 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL318445: [VirtualFileSystem] Support creating directories then adding files inside (authored by benhamilton). Repository: rL LLVM https://reviews.llvm.org/D40140 Files: cfe/trunk/include/clang/Basic/

[PATCH] D40180: [clang-tools-extra] Fix small typo in docs/ReleaseNotes.rst

2017-11-17 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. This is mainly a test diff to check the new Herald rule I added in LLVM Phabricator to automatically Cc: cfe-commits on all clang-tools-extra diffs. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D40180 Files: docs/ReleaseNotes.rst Index: d

[PATCH] D147577: [Format/ObjC] Support NS_ERROR_ENUM in ObjC language guesser

2023-04-04 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: sammccall, MyDeveloperDay. Herald added projects: All, clang, clang-format. Herald added a subscriber: cfe-commits. Herald added reviewers: rymiel, HazardyKnusperkeks, owenpan. benhamilton requested review of this revision. Apple adde

[PATCH] D147577: [Format/ObjC] Support NS_ERROR_ENUM in ObjC language guesser

2023-04-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 511539. benhamilton added a comment. Rebasing. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D147577/new/ https://reviews.llvm.org/D147577 Files: clang/lib/Format/Format.cpp clang/lib/Format/FormatToken

[PATCH] D147577: [Format/ObjC] Support NS_ERROR_ENUM in ObjC language guesser

2023-04-07 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Filed https://github.com/llvm/llvm-project/issues/62007 on the buildkite failure (despite it being in `git-clang-format`, I'm about 98% sure it's unrelated). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D147577/new/ h

[PATCH] D147577: [Format/ObjC] Support NS_ERROR_ENUM in ObjC language guesser

2023-04-07 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG00ea6798959d: [Format/ObjC] Support NS_ERROR_ENUM in ObjC language guesser (authored by benhamilton). Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D147577: [Format/ObjC] Support NS_ERROR_ENUM in ObjC language guesser

2023-04-07 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a subscriber: goncharov. benhamilton added a comment. In D147577#4252225 , @MyDeveloperDay wrote: > The build machines aren’t using a latest enough version of clang-format for > our local .clang-format file Thanks, that's what I figur

<    1   2   3   4   >