Re: [llvm-dev] RFC: Modernizing our use of auto

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] RFC: Modernizing our use of auto

Oleg Smolsky via cfe-dev
On Nov 25, 2018, at 6:43 AM, Stephen Kelly via llvm-dev <[hidden email]> wrote:

>
>
> I'm not advocating AAA.
>
> However this is a proposal for more modern thinking regarding the permissiveness of auto in LLVM codebases.
>
> Currently the rule on the use of auto is here:
>
> https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable
>
> It is quite strict.

Sure, the approach of the standards doc is to be quite strict but leave open the door for reasonable human discretion during code review.  That said, you’re right that this should be improved.

> It allows the use of auto for
>
> * lambdas
> * iterators because they are long to type
> * casts to the type
>
> but generally leaves the rest up to the reviewer, not the contributor.
>
> The notes about "more readable", "easier to maintain", "obvious from the context" are very subjective.

Indeed, intentionally so.  Being accurate is difficult.

> I think these guidelines need to be made more clear both in that subjective sense, but also in the sense of use of new/recent language and library features, given that LLVM will allow C++17 features in a few months.

Sure, here is MHO (not intended to be prescriptive):

> For example:
>
> * Can we use auto in the initializer of range-for statements?

Yes, if it is contextually obvious what the element type of the container is.

> * Can we use auto in the initializer of if() statements?

Yes, if it is contextually obvious what the type is, because it is the result of a dyncast etc.  No in general.

> * Can we use auto with llvm:Optional instances?

Generally no IMO, because the cases that produce optional are not obvious.

> * Can we use auto in c++14 lambda arguments with llvm::find_if(C, [](const auto& i) { ... }) for example?
> * We need to use auto for structured bindings, if those are used.

These both get into “yes, if the type is contextually obvious”.  I’m not sure how to specify this though.

Perhaps the rule came be rewritten more generally, as in “auto should generally only be used when the inferred type is obvious from context, e.g. as a result of a cast like dyn_cast or as a result of constructing a value with a constructor containing a type name.”?

> So, perhaps the guidelines for reviewers needs to adapt, or the coding guidelines need to adapt.

+1 for adapting to changes in the ecosystem.

> Currently, reviewers reject code of the form
>
>  void foo()
>  {
>    auto ParserInstance = Parser::getFromArgs(Args);

This seems like it could be considered a named constructor.

> In the case that came up in review for me, the code I submitted is
>
> template <typename BaseT, typename DerivedT>
> void registerIfNodeMatcher(...) {
>  auto NodeKind = ASTNodeKind::getFromNodeKind<DerivedT>();
>  if (!NodeKind.isNone())
>    NodeCtors[NodeKind] = std::make_pair(MatcherName, Descriptor);
> }
>
> but it was rejected as unreadable and I was given a link to the coding guidelines.

I agree, this seems overly strict.

> That kind of thing is coming up as Optional is used more in the codebase, but also with objects which have a validity check such as isNone(), isValid(), isNull() or just `!= nullptr` etc.
>
> I'd also like to update them so that
>
> llvm::Optional<std::pair<std::string, MatcherCtor>>
> getNodeConstructorType(ASTNodeKind targetType) {
>  auto const &ctors = RegistryData->nodeConstructors();
>  auto it = llvm::find_if(
>      ctors, [targetType](const NodeConstructorMap::value_type &ctor) {
>        return ctor.first.isSame(targetType);
>      });
>  if (it == ctors.end())
>    return llvm::None;
>  return it->second;
> }
>
> is acceptable. The `auto it` is already acceptable, but the `auto const& ctors` depends on an interpretation of the guideline and was rejected in the review I submitted.

This seems like a step too far from me.  I don’t know what nodeConstructors is here at all, and you’ve erased all type information about what you’re dealing with.

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] RFC: Modernizing our use of auto

Oleg Smolsky via cfe-dev
Le mer. 28 nov. 2018 à 09:26, Chris Lattner via llvm-dev
<[hidden email]> a écrit :

>
> On Nov 25, 2018, at 6:43 AM, Stephen Kelly via llvm-dev <[hidden email]> wrote:
> >
> >
> > I'm not advocating AAA.
> >
> > However this is a proposal for more modern thinking regarding the permissiveness of auto in LLVM codebases.
> >
> > Currently the rule on the use of auto is here:
> >
> > https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable
> >
> > It is quite strict.
>
> Sure, the approach of the standards doc is to be quite strict but leave open the door for reasonable human discretion during code review.  That said, you’re right that this should be improved.
>
> > It allows the use of auto for
> >
> > * lambdas
> > * iterators because they are long to type
> > * casts to the type
> >
> > but generally leaves the rest up to the reviewer, not the contributor.
> >
> > The notes about "more readable", "easier to maintain", "obvious from the context" are very subjective.
>
> Indeed, intentionally so.  Being accurate is difficult.
>
> > I think these guidelines need to be made more clear both in that subjective sense, but also in the sense of use of new/recent language and library features, given that LLVM will allow C++17 features in a few months.
>
> Sure, here is MHO (not intended to be prescriptive):
>
> > For example:
> >
> > * Can we use auto in the initializer of range-for statements?
>
> Yes, if it is contextually obvious what the element type of the container is.
>
> > * Can we use auto in the initializer of if() statements?
>
> Yes, if it is contextually obvious what the type is, because it is the result of a dyncast etc.  No in general.
>
> > * Can we use auto with llvm:Optional instances?
>
> Generally no IMO, because the cases that produce optional are not obvious.
>
> > * Can we use auto in c++14 lambda arguments with llvm::find_if(C, [](const auto& i) { ... }) for example?
> > * We need to use auto for structured bindings, if those are used.
>
> These both get into “yes, if the type is contextually obvious”.  I’m not sure how to specify this though.
>
> Perhaps the rule came be rewritten more generally, as in “auto should generally only be used when the inferred type is obvious from context, e.g. as a result of a cast like dyn_cast or as a result of constructing a value with a constructor containing a type name.”?

FWIW
+1

>
> > So, perhaps the guidelines for reviewers needs to adapt, or the coding guidelines need to adapt.
>
> +1 for adapting to changes in the ecosystem.
>
> > Currently, reviewers reject code of the form
> >
> >  void foo()
> >  {
> >    auto ParserInstance = Parser::getFromArgs(Args);
>
> This seems like it could be considered a named constructor.
>
> > In the case that came up in review for me, the code I submitted is
> >
> > template <typename BaseT, typename DerivedT>
> > void registerIfNodeMatcher(...) {
> >  auto NodeKind = ASTNodeKind::getFromNodeKind<DerivedT>();
> >  if (!NodeKind.isNone())
> >    NodeCtors[NodeKind] = std::make_pair(MatcherName, Descriptor);
> > }
> >
> > but it was rejected as unreadable and I was given a link to the coding guidelines.
>
> I agree, this seems overly strict.
>
> > That kind of thing is coming up as Optional is used more in the codebase, but also with objects which have a validity check such as isNone(), isValid(), isNull() or just `!= nullptr` etc.
> >
> > I'd also like to update them so that
> >
> > llvm::Optional<std::pair<std::string, MatcherCtor>>
> > getNodeConstructorType(ASTNodeKind targetType) {
> >  auto const &ctors = RegistryData->nodeConstructors();
> >  auto it = llvm::find_if(
> >      ctors, [targetType](const NodeConstructorMap::value_type &ctor) {
> >        return ctor.first.isSame(targetType);
> >      });
> >  if (it == ctors.end())
> >    return llvm::None;
> >  return it->second;
> > }
> >
> > is acceptable. The `auto it` is already acceptable, but the `auto const& ctors` depends on an interpretation of the guideline and was rejected in the review I submitted.
>
> This seems like a step too far from me.  I don’t know what nodeConstructors is here at all, and you’ve erased all type information about what you’re dealing with.

+1

>
> -Chris
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] RFC: Modernizing our use of auto

Oleg Smolsky via cfe-dev
In reply to this post by Oleg Smolsky via cfe-dev
On Wed, Nov 28, 2018 at 6:25 PM Chris Lattner via cfe-dev <[hidden email]> wrote:
Generally no IMO, because the cases that produce optional are not obvious.

Just to say, +1 from me too.
 

> * Can we use auto in c++14 lambda arguments with llvm::find_if(C, [](const auto& i) { ... }) for example?
> * We need to use auto for structured bindings, if those are used.

These both get into “yes, if the type is contextually obvious”.  I’m not sure how to specify this though.

Perhaps the rule came be rewritten more generally, as in “auto should generally only be used when the inferred type is obvious from context, e.g. as a result of a cast like dyn_cast or as a result of constructing a value with a constructor containing a type name.”?

Strongly agree.

I understand it may not be as precise and unambiguous as people would like, I still think this is the correct core rule: there needs to be *some* reason why the type is contextually obvious.

And honestly, I'm very happy erring on the side of writing out the type name. I think people are too eager to use `auto` because it is easy to write but it makes the types substantially harder for the reader to understand.

> In the case that came up in review for me, the code I submitted is
>
> template <typename BaseT, typename DerivedT>
> void registerIfNodeMatcher(...) {
>  auto NodeKind = ASTNodeKind::getFromNodeKind<DerivedT>();
>  if (!NodeKind.isNone())
>    NodeCtors[NodeKind] = std::make_pair(MatcherName, Descriptor);
> }
>
> but it was rejected as unreadable and I was given a link to the coding guidelines.

I agree, this seems overly strict.

I mean maybe. But looking at the example, I don't have a clue what type `NodeKind` is. I think this is borderline, and I think its fine to be somewhat subjective based on the reviewer that is more familiar with the code and APIs in question.
 
> I'd also like to update them so that
>
> llvm::Optional<std::pair<std::string, MatcherCtor>>
> getNodeConstructorType(ASTNodeKind targetType) {
>  auto const &ctors = RegistryData->nodeConstructors();
>  auto it = llvm::find_if(
>      ctors, [targetType](const NodeConstructorMap::value_type &ctor) {
>        return ctor.first.isSame(targetType);
>      });
>  if (it == ctors.end())
>    return llvm::None;
>  return it->second;
> }
>
> is acceptable. The `auto it` is already acceptable, but the `auto const& ctors` depends on an interpretation of the guideline and was rejected in the review I submitted.

This seems like a step too far from me.  I don’t know what nodeConstructors is here at all, and you’ve erased all type information about what you’re dealing with.

Strongly agree. The `auto it` continues to seem fine, but the `ctors` here seems super confusing to leave off all type information.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] RFC: Modernizing our use of auto

Oleg Smolsky via cfe-dev
> I think people are too eager to use `auto` because it is easy to write but it makes the types substantially harder for the reader to understand

I'm probably the Nth person to ask this, but what keeps us from promoting the use of a clang-tidy-powered tool that basically emits fixits of s/auto/actual_type/?

It sounds like we're pretty constrained in where we can use auto (which I'm completely in favor of, in no small part because of our pervasive use of types spelled *Ref); a tool that's able to do that replacement and correctly ignore trivially-okay `auto`s >90% of the time sounds like it'd make both sides of this:

> I think people are too eager to use `auto` because it is easy to write but it makes the types substantially harder for the reader to understand.

happy.

Naturally, this gets tricky as we move to c++ versions that allow auto in more places, and is iffy in general in e.g. type-dependent contexts, but I didn't say 100% accuracy ;)

On Tue, Dec 4, 2018 at 2:02 AM Chandler Carruth via llvm-dev <[hidden email]> wrote:
On Wed, Nov 28, 2018 at 6:25 PM Chris Lattner via cfe-dev <[hidden email]> wrote:
Generally no IMO, because the cases that produce optional are not obvious.

Just to say, +1 from me too.
 

> * Can we use auto in c++14 lambda arguments with llvm::find_if(C, [](const auto& i) { ... }) for example?
> * We need to use auto for structured bindings, if those are used.

These both get into “yes, if the type is contextually obvious”.  I’m not sure how to specify this though.

Perhaps the rule came be rewritten more generally, as in “auto should generally only be used when the inferred type is obvious from context, e.g. as a result of a cast like dyn_cast or as a result of constructing a value with a constructor containing a type name.”?

Strongly agree.

I understand it may not be as precise and unambiguous as people would like, I still think this is the correct core rule: there needs to be *some* reason why the type is contextually obvious.

And honestly, I'm very happy erring on the side of writing out the type name. I think people are too eager to use `auto` because it is easy to write but it makes the types substantially harder for the reader to understand.

> In the case that came up in review for me, the code I submitted is
>
> template <typename BaseT, typename DerivedT>
> void registerIfNodeMatcher(...) {
>  auto NodeKind = ASTNodeKind::getFromNodeKind<DerivedT>();
>  if (!NodeKind.isNone())
>    NodeCtors[NodeKind] = std::make_pair(MatcherName, Descriptor);
> }
>
> but it was rejected as unreadable and I was given a link to the coding guidelines.

I agree, this seems overly strict.

I mean maybe. But looking at the example, I don't have a clue what type `NodeKind` is. I think this is borderline, and I think its fine to be somewhat subjective based on the reviewer that is more familiar with the code and APIs in question.
 
> I'd also like to update them so that
>
> llvm::Optional<std::pair<std::string, MatcherCtor>>
> getNodeConstructorType(ASTNodeKind targetType) {
>  auto const &ctors = RegistryData->nodeConstructors();
>  auto it = llvm::find_if(
>      ctors, [targetType](const NodeConstructorMap::value_type &ctor) {
>        return ctor.first.isSame(targetType);
>      });
>  if (it == ctors.end())
>    return llvm::None;
>  return it->second;
> }
>
> is acceptable. The `auto it` is already acceptable, but the `auto const& ctors` depends on an interpretation of the guideline and was rejected in the review I submitted.

This seems like a step too far from me.  I don’t know what nodeConstructors is here at all, and you’ve erased all type information about what you’re dealing with.

Strongly agree. The `auto it` continues to seem fine, but the `ctors` here seems super confusing to leave off all type information.
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] RFC: Modernizing our use of auto

Oleg Smolsky via cfe-dev


> On Dec 4, 2018, at 10:59 AM, George Burgess IV <[hidden email]> wrote:
>
> > I think people are too eager to use `auto` because it is easy to write but it makes the types substantially harder for the reader to understand
>
> I'm probably the Nth person to ask this, but what keeps us from promoting the use of a clang-tidy-powered tool that basically emits fixits of s/auto/actual_type/?

Because the tool would need to apply judgement to when this makes sense.  If we can’t write an algorithm in coding standards.html to be prescriptive about when to use auto, then I don’t think we can automate this.

-Chris


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] RFC: Modernizing our use of auto

Oleg Smolsky via cfe-dev
So the problem becomes one of seeing if people will accept `auto` rules that don't require substantial amounts of thought.

Personally, I see this like our use of clang-format. It might not use my favorite color of paint, but it's uniform, automatic, and it lets me entirely forget about tons of style nits, so I love it to death. Hence, if we need to start with "no auto, except in this small set of trivially OK and machine-verifiable cases, which we'll consider expanding this as need arises," to get to that, I'd be all for it.

I realize that many devs probably strongly disagree with me here, but that's my 2c.

On Wed, Dec 5, 2018 at 9:26 PM Chris Lattner <[hidden email]> wrote:


> On Dec 4, 2018, at 10:59 AM, George Burgess IV <[hidden email]> wrote:
>
> > I think people are too eager to use `auto` because it is easy to write but it makes the types substantially harder for the reader to understand
>
> I'm probably the Nth person to ask this, but what keeps us from promoting the use of a clang-tidy-powered tool that basically emits fixits of s/auto/actual_type/?

Because the tool would need to apply judgement to when this makes sense.  If we can’t write an algorithm in coding standards.html to be prescriptive about when to use auto, then I don’t think we can automate this.

-Chris



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] RFC: Modernizing our use of auto

Oleg Smolsky via cfe-dev
I agree with George here, the current implementation of modernize-use-auto uses pretty much the same rules as described in our coding standards which we all agree on, mainly:
- iterators (begin, end)
- cast expressions
- new expression

Ofc there are more cases where type is obvious and where we would like to use auto, but automating the part that modernize-use-auto can do is enough to cover most of the cases.

Cheers
Piotr

czw., 6 gru 2018 o 08:46 George Burgess IV via cfe-dev <[hidden email]> napisał(a):
So the problem becomes one of seeing if people will accept `auto` rules that don't require substantial amounts of thought.

Personally, I see this like our use of clang-format. It might not use my favorite color of paint, but it's uniform, automatic, and it lets me entirely forget about tons of style nits, so I love it to death. Hence, if we need to start with "no auto, except in this small set of trivially OK and machine-verifiable cases, which we'll consider expanding this as need arises," to get to that, I'd be all for it.

I realize that many devs probably strongly disagree with me here, but that's my 2c.

On Wed, Dec 5, 2018 at 9:26 PM Chris Lattner <[hidden email]> wrote:


> On Dec 4, 2018, at 10:59 AM, George Burgess IV <[hidden email]> wrote:
>
> > I think people are too eager to use `auto` because it is easy to write but it makes the types substantially harder for the reader to understand
>
> I'm probably the Nth person to ask this, but what keeps us from promoting the use of a clang-tidy-powered tool that basically emits fixits of s/auto/actual_type/?

Because the tool would need to apply judgement to when this makes sense.  If we can’t write an algorithm in coding standards.html to be prescriptive about when to use auto, then I don’t think we can automate this.

-Chris


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] RFC: Modernizing our use of auto

Oleg Smolsky via cfe-dev
In reply to this post by Oleg Smolsky via cfe-dev


On Wed, Dec 5, 2018, 9:27 PM Chris Lattner via cfe-dev <[hidden email] wrote:


> On Dec 4, 2018, at 10:59 AM, George Burgess IV <[hidden email]> wrote:
>
> > I think people are too eager to use `auto` because it is easy to write but it makes the types substantially harder for the reader to understand
>
> I'm probably the Nth person to ask this, but what keeps us from promoting the use of a clang-tidy-powered tool that basically emits fixits of s/auto/actual_type/?

For me: I still don't know how to integrate clang-tidy into my development workflow. I'm open to pointers to documentation/etc.

Because the tool would need to apply judgement to when this makes sense.  If we can’t write an algorithm in coding standards.html to be prescriptive about when to use auto, then I don’t think we can automate this.

Yeah, I don't think we can automate it entirely, but at least it might lower the writing cost to make it easier for folks favoring auto for writability where community standards would prefer the named type. Nice thing about clang-tidy etc is if integrated well, it should only flag on code in the current diff, and only as a suppressible suggestion not a hard requirement.

I think if folks want to work on that, it'd be appreciated, but I don't think it changes the discussion around what style we want.




-Chris


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] RFC: Modernizing our use of auto

Oleg Smolsky via cfe-dev
In reply to this post by Oleg Smolsky via cfe-dev
I think modernize-use-auto is good for the problem we aren't discussion and maybe a problem we don't have (using auto not enough and wanting to migrate code to use it more). A tool that gives a "hey, maybe your use of auto here is more for writability than readability" would be a different thing, and probably a bit challenging to tune it's false positive rate to not be annoying etc.

On Thu, Dec 6, 2018, 2:13 AM Piotr Padlewski via llvm-dev <[hidden email] wrote:
I agree with George here, the current implementation of modernize-use-auto uses pretty much the same rules as described in our coding standards which we all agree on, mainly:
- iterators (begin, end)
- cast expressions
- new expression

Ofc there are more cases where type is obvious and where we would like to use auto, but automating the part that modernize-use-auto can do is enough to cover most of the cases.

Cheers
Piotr

czw., 6 gru 2018 o 08:46 George Burgess IV via cfe-dev <[hidden email]> napisał(a):
So the problem becomes one of seeing if people will accept `auto` rules that don't require substantial amounts of thought.

Personally, I see this like our use of clang-format. It might not use my favorite color of paint, but it's uniform, automatic, and it lets me entirely forget about tons of style nits, so I love it to death. Hence, if we need to start with "no auto, except in this small set of trivially OK and machine-verifiable cases, which we'll consider expanding this as need arises," to get to that, I'd be all for it.

I realize that many devs probably strongly disagree with me here, but that's my 2c.

On Wed, Dec 5, 2018 at 9:26 PM Chris Lattner <[hidden email]> wrote:


> On Dec 4, 2018, at 10:59 AM, George Burgess IV <[hidden email]> wrote:
>
> > I think people are too eager to use `auto` because it is easy to write but it makes the types substantially harder for the reader to understand
>
> I'm probably the Nth person to ask this, but what keeps us from promoting the use of a clang-tidy-powered tool that basically emits fixits of s/auto/actual_type/?

Because the tool would need to apply judgement to when this makes sense.  If we can’t write an algorithm in coding standards.html to be prescriptive about when to use auto, then I don’t think we can automate this.

-Chris


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] RFC: Modernizing our use of auto

Oleg Smolsky via cfe-dev
In reply to this post by Oleg Smolsky via cfe-dev


On Dec 6, 2018, at 11:37 AM, David Blaikie via llvm-dev <[hidden email]> wrote:



On Wed, Dec 5, 2018, 9:27 PM Chris Lattner via cfe-dev <[hidden email] wrote:


> On Dec 4, 2018, at 10:59 AM, George Burgess IV <[hidden email]> wrote:
>
> > I think people are too eager to use `auto` because it is easy to write but it makes the types substantially harder for the reader to understand
>
> I'm probably the Nth person to ask this, but what keeps us from promoting the use of a clang-tidy-powered tool that basically emits fixits of s/auto/actual_type/?

For me: I still don't know how to integrate clang-tidy into my development workflow. I'm open to pointers to documentation/etc.

Not sure if this helps, but CMake actually added support for integrating clang-tidy with your build:

I haven’t used it with LLVM because LLVM and Clang aren’t clang-tidy clean, but I do use it on other projects that are, and it works really well.

-Chris


Because the tool would need to apply judgement to when this makes sense.  If we can’t write an algorithm in coding standards.html to be prescriptive about when to use auto, then I don’t think we can automate this.

Yeah, I don't think we can automate it entirely, but at least it might lower the writing cost to make it easier for folks favoring auto for writability where community standards would prefer the named type. Nice thing about clang-tidy etc is if integrated well, it should only flag on code in the current diff, and only as a suppressible suggestion not a hard requirement.

I think if folks want to work on that, it'd be appreciated, but I don't think it changes the discussion around what style we want.




-Chris


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev