This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Simplify too-small loop variable check
AbandonedPublic

Authored by steveire on Feb 5 2021, 6:53 AM.

Details

Summary

Don't issue a warning from within a template declaration which is most
likely not actionable.

Diff Detail

Event Timeline

steveire created this revision.Feb 5 2021, 6:53 AM
steveire requested review of this revision.Feb 5 2021, 6:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2021, 6:53 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I'm not sure about this. The warning is good and addresses a real problem.
I'm not sure what the infrastructure surrounding this is but in clang it would show a "stack trace" of instantiations that result in this warning. Maybe we should think of something similar in clang tidy.

I'm not sure about this. The warning is good and addresses a real problem.

Well, I've made the diagnostic better anyway.

I'm not sure about this. The warning is good and addresses a real problem.

Well, I've made the diagnostic better anyway.

I'm not sure its an improvement. If the template is never instantiated with something that would trigger this, we shouldn't really warn on it.
There are plenty of times when certain template definitions will error if certain template parameters are passed to them.
This is well defined and no compiler will ever warn on those situations.

steveire abandoned this revision.Feb 16 2021, 3:40 PM

I'm not sure about this. The warning is good and addresses a real problem.

Well, I've made the diagnostic better anyway.

I'm not sure its an improvement. If the template is never instantiated with something that would trigger this, we shouldn't really warn on it.
There are plenty of times when certain template definitions will error if certain template parameters are passed to them.
This is well defined and no compiler will ever warn on those situations.

Yes, fair point. I still don't think the existing diagnostic is valuable, but removing the diagnostic would be the inevitable result of a change like this.