Page MenuHome

Clang Tidy: use .empty() instead of comparing with .size()
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on Jul 3 2020, 1:49 PM.

Details

Summary

Just wanted you to check if it compiles for you.
I was wondering, because it does not find the vector.size() == 0
checks in cycles code. That might be, because it's using a subclassed
vector.

Diff Detail

Repository
rB Blender
Branch
size-to-empty (branched from master)
Build Status
Buildable 8828
Build 8828: arc lint + arc unit

Event Timeline

Jacques Lucke (JacquesLucke) requested review of this revision.Jul 3 2020, 1:49 PM

Subclass should be fine. AFAIK clang-tidy applies the check to any class which has size() and empty().

The fact that usages in Cycles are not found is because clang-tidy is only enabled in source/ directory. In the future we can selectively enable in intern' as well, but it's a bit more tricky.

From quick look the patch seems correct.

This revision is now accepted and ready to land.Jul 3 2020, 2:34 PM