[PATCH] D46659: [clang-tidy/google-readability-casting] Allow C-style casts to/from Objective-C object types

2018-05-09 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: alexfh, Wizard, hokein. Herald added a subscriber: cfe-commits. Previously, `google-readability-casting` would trigger for Objective-C++ code using C-style casts to or from Objective-C object types. The official Google Objective-C st

[PATCH] D46659: [clang-tidy/google-readability-casting] Allow C-style casts to/from Objective-C object types

2018-05-09 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. An alternative implementation would be to allow C-style casts (either always or only for ObjC objects) within Objective-C methods inside Objective-C++ files, but that may get messy with things like shared macros. Repository: rCTE Clang Tools Extra https://review

[PATCH] D46659: [clang-tidy/google-readability-casting] Allow C-style casts to/from Objective-C object types

2018-05-16 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 147102. benhamilton added a comment. - Change to simply disable check for Objective-C++ Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D46659 Files: clang-tidy/google/AvoidCStyleCastsCheck.cpp test/clang-tidy/google-readability-casti

[PATCH] D46659: [clang-tidy/google-readability-casting] Disable check for Objective-C++

2018-05-16 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. After discussion, I changed this diff to simply disable the check altogether for Objective-C++. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D46659 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[PATCH] D46659: [clang-tidy/google-readability-casting] Disable check for Objective-C++

2018-05-16 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: clang-tidy/google/AvoidCStyleCastsCheck.cpp:103-104 // The rest of this check is only relevant to C++. - if (!getLangOpts().CPlusPlus) + // We also disable it for Objective-C++. + if (!getLangOpts().CPlusPlus || getLangOpts().O

[PATCH] D46659: [clang-tidy/google-readability-casting] Disable check for Objective-C++

2018-05-16 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL332516: [clang-tidy/google-readability-casting] Disable check for Objective-C++ (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.ll

[PATCH] D47028: [clang-format/ObjC] Correctly annotate single-component ObjC method invocations

2018-05-17 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's parser would fail to annotate the selector in a single-component Objective-C method invocation with `TT_SelectorName`. For example, the follo

[PATCH] D47028: [clang-format/ObjC] Correctly annotate single-component ObjC method invocations

2018-05-18 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:510 +CurrentToken->Previous->Type = TT_SelectorName; + } // determineStarAmpUsage() thinks that '*' '[' is allocating an jolesiak wrote: > I'd remove brac

[PATCH] D47028: [clang-format/ObjC] Correctly annotate single-component ObjC method invocations

2018-05-18 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 147516. benhamilton marked an inline comment as done. benhamilton added a comment. Style Repository: rC Clang https://reviews.llvm.org/D47028 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestObjC.cpp Index: unittests/Format/Forma

[PATCH] D47028: [clang-format/ObjC] Correctly annotate single-component ObjC method invocations

2018-05-18 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC332727: [clang-format/ObjC] Correctly annotate single-component ObjC method invocations (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D47028?vs=147516&id=1

[PATCH] D47095: [clang-format/ObjC] Correctly parse Objective-C methods with 'class' in name

2018-05-18 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: djasper, jolesiak. Herald added subscribers: cfe-commits, klimek. Please take a close look at this CL. I haven't touched much of `UnwrappedLineParser` before, so I may have gotten things wrong. Previously, clang-format would incorrec

[PATCH] D47095: [clang-format/ObjC] Correctly parse Objective-C methods with 'class' in name

2018-05-18 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 147611. benhamilton added a comment. Format Repository: rC Clang https://reviews.llvm.org/D47095 Files: lib/Format/UnwrappedLineParser.cpp lib/Format/UnwrappedLineParser.h unittests/Format/FormatTestObjC.cpp Index: unittests/Format/FormatTestO

[PATCH] D47195: [clang-format] Fix ObjC message arguments handling

2018-05-22 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. Please address @krasimir's comments, but looks good to me. Repository: rC Clang https://reviews.llvm.org/D47195 ___ cfe-commits mail

[PATCH] D47195: [clang-format] Fix ObjC message arguments handling

2018-05-22 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Can you update the diff description to reflect that it includes the original change? Repository: rC Clang https://reviews.llvm.org/D47195 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/

[PATCH] D40221: [clang-format] Parse blocks in braced lists

2018-05-23 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton edited reviewers, added: klimek; removed: djasper. benhamilton added a comment. @djasper isn't available to review. At a high level, this seems good, but I'd like @klimek to take a look. Comment at: lib/Format/UnwrappedLineParser.cpp:1320 +// \endcode +bool Unwrapp

[PATCH] D47095: [clang-format/ObjC] Correctly parse Objective-C methods with 'class' in name

2018-05-23 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/UnwrappedLineParser.cpp:2137 + do { +if (FormatTok->Tok.isOneOf(tok::semi, tok::r_brace)) { + nextToken(); jolesiak wrote: > `tok::r_brace` could be skiped - see comment to line 2143. Done. ===

[PATCH] D47095: [clang-format/ObjC] Correctly parse Objective-C methods with 'class' in name

2018-05-23 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 148231. benhamilton marked 2 inline comments as done. benhamilton added a comment. @jolesiak Repository: rC Clang https://reviews.llvm.org/D47095 Files: lib/Format/UnwrappedLineParser.cpp lib/Format/UnwrappedLineParser.h unittests/Format/Format

[PATCH] D51575: [clang-tidy] Implement a clang-tidy check to verify Google Objective-C function naming conventions 📜

2018-09-05 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. Thanks for this! Let's consolidate this with the property name checker (either simplify the logic there and allow `arBiTRAryCapSAnYWHere` or apply the same registered acron

[PATCH] D51575: [clang-tidy] Implement a clang-tidy check to verify Google Objective-C function naming conventions 📜

2018-09-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: clang-tidy/google/FunctionNamingCheck.cpp:35 + // non-standard capitalized character sequences including acronyms, + // initialisms, and prefixes of symbols (e.g., UIColorFromNSString). For this + // reason, the regex only verifie

[PATCH] D51819: [clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheck

2018-09-07 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: Wizard, hokein. Herald added a subscriber: cfe-commits. This adds a few common acronyms we found were missing from PropertyDeclarationCheck. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D51819 Files: clang-tidy

[PATCH] D51819: [clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheck

2018-09-07 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 164523. benhamilton added a comment. - Update docs. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D51819 Files: clang-tidy/objc/PropertyDeclarationCheck.cpp docs/clang-tidy/checks/objc-property-declaration.rst Index: docs/clang-ti

[PATCH] D51819: [clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheck

2018-09-07 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL341720: [clang-tidy/ObjC] Update list of acronyms in PropertyDeclarationCheck (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.

[PATCH] D51832: [clang-tidy/checks] Update objc-property-declaration check to allow arbitrary acronyms and initialisms 🔧

2018-09-10 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. This is fine, but please update the comments (and docs?) to make it clear that we no longer enforce camelCase but allow aRBiTraRYcAsE now. Comment at: clang-tidy/o

[PATCH] D42704: [clang-format] Do not break Objective-C string literals inside array literals

2018-02-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Ping ping! Repository: rC Clang https://reviews.llvm.org/D42704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D42704: [clang-format] Do not break Objective-C string literals inside array literals

2018-02-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. @stephanemoore: It appears all warnings are enabled by default unless they are in class `DefaultIgnore`: https://github.com/llvm-mirror/clang/blob/6de2efd1953adaa9a190b2cdfbe7b5c15f6d6efe/include/clang/Basic/Diagnostic.td#L105 This diagnostic is not in `DefaultIgnor

[PATCH] D42650: [clang-format] New format param ObjCBinPackProtocolList

2018-02-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton marked an inline comment as done. benhamilton added a comment. > I don't understand why do we introduce an enum option if we are keeping the > default behavior for Google style. IMO we should have a single behavior for > any style and enforce it. https://reviews.llvm.org/D42708 chan

[PATCH] D42947: Support special acronyms inside property names and allow plural forms

2018-02-06 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. Can you add test cases for non-plural acronyms in the middle of the string and plural acronyms at the start/end of the string, please? Comment at: clang-

[PATCH] D42864: [clang-format] Add more tests for Objective-C 2.0 generic alignment

2018-02-06 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL324364: [clang-format] Add more tests for Objective-C 2.0 generic alignment (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.o

[PATCH] D42864: [clang-format] Add more tests for Objective-C 2.0 generic alignment

2018-02-06 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC324364: [clang-format] Add more tests for Objective-C 2.0 generic alignment (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D42864?vs=132654&id=133036#toc Re

[PATCH] D42947: Support special acronyms inside property names and allow plural forms

2018-02-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton accepted this revision. benhamilton added inline comments. This revision is now accepted and ready to land. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:144 + "[A-Z]?)?[a-z]+[a-z0-9]*(" + + AcronymsGroupRegex(EscapedAcronyms, true) + "|([A-

[PATCH] D42708: [clang-format] Set ObjCBinPackProtocolList to Never for google style

2018-02-07 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC324553: [clang-format] Set ObjCBinPackProtocolList to Never for google style (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D42708?vs=132189&id=133349#toc R

[PATCH] D42704: [clang-format] Do not break Objective-C string literals inside array literals

2018-02-08 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC324618: [clang-format] Do not break Objective-C string literals inside array literals (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D42704?vs=132031&id=1334

[PATCH] D43124: [clang-format] Improve ObjC headers detection

2018-02-09 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. testcase Repository: rC Clang https://reviews.llvm.org/D43124 __

[PATCH] D43114: clang-format: fix formatting of ObjC @synchronized blocks

2018-02-09 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/UnwrappedLineParser.cpp:1130 +if (FormatTok->Tok.is(tok::l_brace)) { + if (Style.BraceWrapping.AfterObjCDeclaration) +addUnwrappedLine(); Typz wrote: > Wondering if formatting

[PATCH] D43114: clang-format: fix formatting of ObjC @synchronized blocks

2018-02-12 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/UnwrappedLineParser.cpp:1130 +if (FormatTok->Tok.is(tok::l_brace)) { + if (Style.BraceWrapping.AfterObjCDeclaration) +addUnwrappedLine(); Typz wrote: > benhamilton wrote: > > T

[PATCH] D43232: clang-format: use AfterControlStatement to format ObjC control blocks

2018-02-14 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. Thanks! Can you add a test for this, please? Repository: rC Clang https://reviews.llvm.org/D43232 ___ cfe-commits mailing

[PATCH] D43232: clang-format: use AfterControlStatement to format ObjC control blocks

2018-02-15 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > This used to happen before as well, and would require fixing > UnwrappedLineFormatter.cpp to understand that these blocks are linked to the > previous ObjC keyword. Good find! Looks like we should fix that and add some more tests with AfterControlStatement set to

[PATCH] D43114: clang-format: fix formatting of ObjC @synchronized blocks

2018-02-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. Just a question on the test. Comment at: unittests/Format/FormatTestObjC.cpp:193-198 + verifyFormat("@synchronized(self) {\n" + " f();\n" +

[PATCH] D43522: [clang-format] New API guessLanguage()

2018-02-20 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added a reviewer: jolesiak. Herald added subscribers: cfe-commits, klimek. benhamilton added a reviewer: krasimir. For clients which don't have a filesystem, calling getStyle() doesn't make much sense (there's no .clang-format files to search for). I

[PATCH] D43522: [clang-format] New API guessLanguage()

2018-02-21 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC325691: [clang-format] New API guessLanguage() (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D43522?vs=135121&id=135261#toc Repository: rC Clang https:/

[PATCH] D43522: [clang-format] New API guessLanguage()

2018-02-21 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL325691: [clang-format] New API guessLanguage() (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D43522 Files: cfe/trunk

[PATCH] D43522: [clang-format] New API guessLanguage()

2018-02-21 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: cfe/trunk/lib/Format/Format.cpp:2298 +FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code) { + FormatStyle::LanguageKind result = getLanguageByFileName(FileName); + if (result == FormatStyle::LK_Cpp) { --

[PATCH] D43590: [clang-format] Fix regression when getStyle() called with empty filename

2018-02-21 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: vsapsai, jolesiak, krasimir. Herald added subscribers: cfe-commits, klimek. https://reviews.llvm.org/D43522 caused an assertion failure when getStyle() was called with an empty filename: https://reviews.llvm.org/P8065 This adds a t

[PATCH] D43590: [clang-format] Fix regression when getStyle() called with empty filename

2018-02-21 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC325722: [clang-format] Fix regression when getStyle() called with empty filename (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D43590?vs=135314&id=135321#to

[PATCH] D43522: [clang-format] New API guessLanguage()

2018-02-21 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: cfe/trunk/lib/Format/Format.cpp:2308 + Guesser.process(); + if (Guesser.isObjC()) { +result = FormatStyle::LK_ObjC; djasper wrote: > benhamilton wrote: > > djasper wrote: > > > In LLVM, we generally

[PATCH] D43522: [clang-format] New API guessLanguage()

2018-02-21 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Follow-ups (aside from the case, which I already fixed) in https://reviews.llvm.org/D43598. Repository: rL LLVM https://reviews.llvm.org/D43522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llv

[PATCH] D43598: [clang-format] Tidy up new API guessLanguage()

2018-02-21 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 a few issues djasper@ brought up in his review of https://reviews.llvm.org/D43522. Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

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

2017-12-14 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 126969. benhamilton marked an inline comment as done. benhamilton added a comment. - Use 40 column limit for test. Repository: rC Clang https://reviews.llvm.org/D41195 Files: lib/Format/Format.cpp unittests/Format/FormatTestObjC.cpp Index: unit

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

2017-12-14 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: unittests/Format/FormatTestObjC.cpp:388 + // Wrapped method parameters should be indented. + verifyFormat("- (VeryLongReturnTypeName)\n" + "veryLongMethodParameter:(VeryLongParameterName)" djasper

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

2017-12-14 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC320714: [ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D41195?vs=126969&id=1

[PATCH] D41789: [clang-tidy] Function-scoped static variables should not trigger google-objc-global-variable-declaration

2018-01-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: Wizard, hokein, klimek. Herald added subscribers: cfe-commits, xazax.hun. google-objc-global-variable-declaration currently triggers on valid code like: - (void)foo { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ /*

[PATCH] D41789: [clang-tidy] Function-scoped static variables should not trigger google-objc-global-variable-declaration

2018-01-05 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE321914: [clang-tidy] Function-scoped static variables should not trigger google-objc… (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.org/D41789?vs=128814&id=12

[PATCH] D41918: [libunwind] Set up .arcconfig to point to new Diffusion UNW repository

2018-01-10 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. Too funny. I'll abandon https://reviews.llvm.org/D41917. Repository: rUNW libunwind https://reviews.llvm.org/D41918 ___ cfe-commits

[PATCH] D43775: add UUID to the acronyms list of objc property name checks

2018-02-27 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton accepted this revision. benhamilton added inline comments. This revision is now accepted and ready to land. Comment at: clang-tidy/objc/PropertyDeclarationCheck.cpp:52 "GIF", "GPS", "HD", Might as well also add GUID. Repository: rC

[PATCH] D43732: Resolve build bot problems in unittests/Format/FormatTest.cpp

2018-02-27 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Thanks for fixing this. (Sorry for not getting to it, I was away traveling until today.) I'll add a tidy-up in https://reviews.llvm.org/D43598 to ensure all tests which call `getStyle()` pass in an in-memory filesystem. Repository: rC Clang https://reviews.llvm

[PATCH] D43732: Resolve build bot problems in unittests/Format/FormatTest.cpp

2018-02-27 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Actually, looks like all the other tests explicitly want a non-empty in-memory FS, so there's no good cleanup I can do. Repository: rC Clang https://reviews.llvm.org/D43732 ___ cfe-commits mailing list cfe-commits@li

[PATCH] D43598: [clang-format] Tidy up new API guessLanguage()

2018-02-27 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL326205: [clang-format] Tidy up new API guessLanguage() (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D43598?vs=1353

[PATCH] D43775: add UUID to the acronyms list of objc property name checks

2018-02-27 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. LGTM. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D43775 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

2018-02-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: krasimir, jolesiak. Herald added a subscriber: cfe-commits. Previously, clang-format would detect C++11 and C++17 attribute specifiers like the following as Objective-C method invocations: [[noreturn]]; [[clang::fallthrough]];

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-02-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: krasimir, jolesiak. Herald added a subscriber: cfe-commits. Previously, clang-format would detect the following as an Objective-C for-in statement: for (int x = in.value(); ...) {} because the logic only decided a for-loop was def

[PATCH] D43905: [clang-format] Improve detection of ObjC for-in statements

2018-02-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton abandoned this revision. benhamilton added a comment. Whoops, sent out twice. Repository: rC Clang https://reviews.llvm.org/D43905 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-02-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: krasimir, jolesiak. Herald added a subscriber: cfe-commits. Previously, clang-format would detect the following as an Objective-C block type: FOO(^); when it actually must be a C or C++ macro dealing with an XOR statement or an XO

[PATCH] D43905: [clang-format] Improve detection of ObjC for-in statements

2018-02-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: krasimir, jolesiak. Previously, clang-format would detect the following as an Objective-C for-in statement: for (int x = in.value(); ...) {} because the logic only decided a for-loop was definitely *not* an Objective-C for-in loop

[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

2018-02-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:346 + bool parseCpp11AttributeSpecifier(FormatToken *Tok) { +if (!Style.isCpp()) return false; +if (!Tok || !Tok->startsSequence(tok::l_square, tok::l_square)) aaron.ballman wro

[PATCH] D25820: [Sema][Objective-C] Formatting warnings should see through Objective-C message sends

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Herald added subscribers: llvm-commits, jkorous-apple. This caused a regression where `__attribute__((format_arg(X))` no longer works with ObjC message sends. I filed https://bugs.llvm.org/show_bug.cgi?id=36599 and will write a fix. Repository: rL LLVM https://r

[PATCH] D25820: [Sema][Objective-C] Formatting warnings should see through Objective-C message sends

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Actually, looking more deeply, it's possible this is a bug in the Apple SDK: @interface NSBundle - (NSString *)localizedStringForKey:(NSString *)key value:(nullable NSString *)value table:(nullable NSString *)tableName __attribute__((format_arg(1))); @end Sinc

[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137015. benhamilton marked 7 inline comments as done. benhamilton added a comment. Fixes from @jolesiak Repository: rC Clang https://reviews.llvm.org/D43902 Files: lib/Format/FormatToken.h lib/Format/TokenAnnotator.cpp unittests/Format/FormatTe

[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Thanks very much for the code review. I fixed those issues. Comment at: lib/Format/TokenAnnotator.cpp:323 + const FormatToken *parseCpp11Attribute(const FormatToken *Tok, + bool NamespaceAllowed) {

[PATCH] D25820: [Sema][Objective-C] Formatting warnings should see through Objective-C message sends

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > That does look like a bug in the SDK, to me. OK. I'll file a Radar bug upstream; in the meantime, this means since this diff landed in 2016, clang has been raising `-Wformat-extra-args` when compiling any code which passes the result of `-[NSBundle localizedStri

[PATCH] D25820: [Sema][Objective-C] Formatting warnings should see through Objective-C message sends

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. I filed rdar://38143508 to track this. The fix won't be easy; I think `__attribute__((format_arg(X)))` isn't enough to capture how `-[NSBundle localizedStringForKey:value:table:]` works: 1. `__attribute__((format_arg(X)))` doesn't support multiple format arguments,

[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137089. benhamilton marked 5 inline comments as done. benhamilton added a comment. - Fix comments from @krasimir and @djasper. Repository: rC Clang https://reviews.llvm.org/D43902 Files: lib/Format/ContinuationIndenter.cpp lib/Format/FormatToken.

[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:323 + const FormatToken *parseCpp11Attribute(const FormatToken &Tok, + bool NamespaceAllowed) { krasimir wrote: > Please inline this into the o

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137092. benhamilton marked an inline comment as done. benhamilton added a comment. - Fix comments from @djasper and @krasimir. Repository: rC Clang https://reviews.llvm.org/D43904 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.c

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137093. benhamilton added a comment. One more cleanup Repository: rC Clang https://reviews.llvm.org/D43904 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTest.cpp =

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:288 +if (MightBeObjCForRangeLoop) { + FormatToken *ForInToken = Left; djasper wrote: > There can be only one ObjCForIn token in any for loop, right? If that's the > c

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137095. benhamilton marked 2 inline comments as done. benhamilton added a comment. - Fix comments from @djasper and @krasimir. Repository: rC Clang https://reviews.llvm.org/D43906 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.c

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > Would it be enough to only add the block type case? With the macro false > positive, there won't be an open paren after the closing paren, right? Are you asking to remove the block variable cases? I was concerned those would no longer be handled correctly if we do

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:155 + Next->startsSequence(tok::identifier, tok::l_square, +tok::numeric_constant, tok::r_square, +tok::r_paren, tok::l_paren)))

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137199. benhamilton marked an inline comment as done. benhamilton added a comment. - Move ObjC-specific tests to `FormatTestObjC.cpp`. Repository: rC Clang https://reviews.llvm.org/D43904 Files: lib/Format/TokenAnnotator.cpp unittests/Format/Form

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: unittests/Format/FormatTest.cpp:778 +TEST_F(FormatTest, ObjCForInLoop) { + verifyFormat("for (Foo *x = 0; x != in; x++) {\n}"); krasimir wrote: > Please move the ObjC-specific instances to `FormatTestObjC.cpp`. Do

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:155 + Next->startsSequence(tok::identifier, tok::l_square, +tok::numeric_constant, tok::r_square, +tok::r_paren, tok::l_paren)))

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL326815: [clang-format] Improve detection of ObjC for-in statements (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D4

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:155 + Next->startsSequence(tok::identifier, tok::l_square, +tok::numeric_constant, tok::r_square, +tok::r_paren, tok::l_paren)))

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137319. benhamilton added a comment. - Simplify logic and assume we have an ObjC block whenever we see rparen at the end of `(^...)(`. Repository: rC Clang https://reviews.llvm.org/D43906 Files: lib/Format/TokenAnnotator.cpp unittests/Format/For

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. > Right. So the difference is that for blocks, there is always a "(" after the > "(^.)". That should be easy to parse, no? Yep, I've updated this diff to implement that as you recommended. I just had to handle nested parens (I couldn't find an existing way to de

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137320. benhamilton added a comment. Fix comment. Repository: rC Clang https://reviews.llvm.org/D43906 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.cpp unittests/Format/FormatTestObjC.cpp Index: unittests/Format/FormatTest

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-07 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137394. benhamilton added a comment. - Greatly clean up ObjC block type logic by re-using `TT_FunctionTypeLParen` type logic. Repository: rC Clang https://reviews.llvm.org/D43906 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.c

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-07 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:152 + const FormatToken *Next = CurrentToken->getNextNonComment(); + int ParenDepth = 1; + // Handle nested parens in case we have an array of blocks with djasper wrote: >

[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

2018-03-08 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. I made it longer so the two lines (__attribute__((foo)) vs. [[foo]]) had the same length. If I shorten it much more, everything goes on one line. Repository: rC Clang https://reviews.llvm.org/D43902 ___ cfe-commits m

[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

2018-03-08 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137696. benhamilton marked 9 inline comments as done. benhamilton added a comment. Refactor to avoid matching open and close parens. Fix @djasper comments. Repository: rC Clang https://reviews.llvm.org/D43902 Files: lib/Format/ContinuationIndenter.

[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

2018-03-08 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. Great, I refactored it to avoid parsing the matching parens, so there's no more danger of O(N^2) parsing behavior. I had to add a new `InCpp11AttributeSpecifier` boolean to `Context` so when parsing the inner `[]` we didn't treat it as an ObjC message send or an arr

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-12 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton marked an inline comment as done. benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:210 -bool MightBeFunctionType = !Contexts[Contexts.size() - 2].IsExpression; -bool ProbablyFunctionType = CurrentToken->isOneOf(tok::star, tok::amp

[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

2018-03-12 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rC327284: [clang-format] Don't detect C++11 attribute specifiers as ObjC (authored by benhamilton, committed by ). Changed

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-12 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 138024. benhamilton added a comment. - Restore short functionn type variable names and add clarifying comment. Repository: rC Clang https://reviews.llvm.org/D43906 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.cpp unittests/F

[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

2018-03-12 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 rC327285: [clang-format] Improve detection of Objective-C block types (authored by benhamilton, committed by ). Changed prior to commit: https://reviews.llvm.

[PATCH] D25820: [Sema][Objective-C] Formatting warnings should see through Objective-C message sends

2018-03-14 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. >@benhamilton We're planning to use the new attribute in >https://reviews.llvm.org/D27165 to address this issue. I'll get back to that >patch in the near future. Great, thanks for the update. Repository: rL LLVM https://reviews.llvm.org/D25820 __

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

2018-03-19 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: jolesiak, djasper. Herald added subscribers: cfe-commits, klimek. We received reports of the Objective-C style guesser getting a false negative on header files like: CGSize SizeOfThing(MyThing thing); This adds more Core Graphics id

[PATCH] D44634: [clang-format] Detect Objective-C for #import

2018-03-19 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: jolesiak, djasper. Herald added subscribers: cfe-commits, klimek. Previously, the Objective-C heuristic failed to detect headers which #imported Objective-C system framework(s) and declared C functions on top them. This extends the h

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

2018-03-19 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added a comment. I wonder if this wouldn't be better as a clang-tidy check: https://github.com/llvm-mirror/clang-tools-extra/tree/master/clang-tidy/objc Repository: rC Clang https://reviews.llvm.org/D44539 ___ cfe-commits mailing lis

[PATCH] D44638: [clang-format] Fix ObjC selectors with multiple params passed to macro

2018-03-19 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: jolesiak, djasper, Wizard. Herald added subscribers: cfe-commits, klimek. Objective-C selectors can with arguments be in the form: foo: foo:bar: foo:bar:baz: These can be passed to a macro, like NS_SWIFT_NAME(): https://developer.a

  1   2   3   4   >