Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-07 Thread Jonathan B Coe via cfe-commits
jbcoe added a comment. The method I'm using to insert after a function declaration is flawed. Advancing by one character is not always the right thing to do and won't handle cases where there is a space before a semi-colon. I'll add extra tests and see if I can come up with a neater way of hand

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread Jonathan B Coe via cfe-commits
jbcoe planned changes to this revision. jbcoe added a comment. If the destructor is user-declared then I need to `=delete` the compiler-generated copy constructor and copy assignment operator (if they are not defined, if either is defined then they are already handled by this check). The move

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread David Blaikie via cfe-commits
On Wed, Feb 3, 2016 at 1:40 PM, Aaron Ballman wrote: > On Wed, Feb 3, 2016 at 4:13 PM, David Blaikie wrote: > > > > > > On Wed, Feb 3, 2016 at 1:03 PM, Jonathan Coe wrote: > >> > >> > >> > >> On 3 February 2016 at 18:44, David Blaikie wrote: > >>> > >>> > >>> > >>> On Wed, Feb 3, 2016 at 10:23

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread Aaron Ballman via cfe-commits
On Wed, Feb 3, 2016 at 4:13 PM, David Blaikie wrote: > > > On Wed, Feb 3, 2016 at 1:03 PM, Jonathan Coe wrote: >> >> >> >> On 3 February 2016 at 18:44, David Blaikie wrote: >>> >>> >>> >>> On Wed, Feb 3, 2016 at 10:23 AM, Jonathan Coe wrote: All the C++ compilers I have tried using (G

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread David Blaikie via cfe-commits
On Wed, Feb 3, 2016 at 1:03 PM, Jonathan Coe wrote: > > > On 3 February 2016 at 18:44, David Blaikie wrote: > >> >> >> On Wed, Feb 3, 2016 at 10:23 AM, Jonathan Coe wrote: >> >>> All the C++ compilers I have tried using (GCC,Clang,MSVC) will generate >>> assignment operators even if the user de

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread Jonathan Coe via cfe-commits
On 3 February 2016 at 18:44, David Blaikie wrote: > > > On Wed, Feb 3, 2016 at 10:23 AM, Jonathan Coe wrote: > >> All the C++ compilers I have tried using (GCC,Clang,MSVC) will generate >> assignment operators even if the user defines a copy-constructor. This is >> the behaviour I set out to wri

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread David Blaikie via cfe-commits
On Wed, Feb 3, 2016 at 10:23 AM, Jonathan Coe wrote: > All the C++ compilers I have tried using (GCC,Clang,MSVC) will generate > assignment operators even if the user defines a copy-constructor. This is > the behaviour I set out to write a check for. > > The cpp core guide lines recommend definin

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread Jonathan Coe via cfe-commits
All the C++ compilers I have tried using (GCC,Clang,MSVC) will generate assignment operators even if the user defines a copy-constructor. This is the behaviour I set out to write a check for. The cpp core guide lines recommend defining all or none of the special functions https://github.com/isocpp

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread David Blaikie via cfe-commits
Is this really that useful of a rule? The language does the right thing for the most part already (you don't need to explicitly delete them - they're implicitly deleted if you define any others - except for backcompat with C++98, but those cases are deprecated & we should probably split out the war

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments. Comment at: clang-tidy/misc/RuleOfFiveCheck.cpp:30 @@ +29,3 @@ +.bind("copy-ctor")), + unless(hasDescendant(cxxMethodDecl(isCopyAssignmentOperator(), + this); Why is `hasDe

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread Alexander Kornienko via cfe-commits
alexfh added a comment. In http://reviews.llvm.org/D16376#342901, @jbcoe wrote: > I think I'll move this check to `cppcoreguidelines` and call it > `rule-of-five`. Yes, please move it to cppcoreguidelines. > https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c21-if-y

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread Jonathan B Coe via cfe-commits
jbcoe marked an inline comment as done. jbcoe added a comment. I think I'll move this check to `cppcoreguidelines` and call it `rule-of-five`. https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c21-if-you-define-or-delete-any-default-operation-define-or-delete-them-all

Re: [PATCH] D16376: clang-tidy check: rule-of-five

2016-02-03 Thread Jonathan B Coe via cfe-commits
jbcoe retitled this revision from "clang-tidy check: Assignment and Construction" to "clang-tidy check: rule-of-five". jbcoe removed rL LLVM as the repository for this revision. jbcoe updated this revision to Diff 46775. jbcoe added a comment. I've responded to review comments (thanks for those)