Use IgnoreUnlessSpelledInSource to make the matcher code smaller and
more visibly-related to the code.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Pre-merge builder can't apply this patch: https://buildkite.com/llvm-project/diff-checks/builds/18651
Is it based on https://reviews.llvm.org/D91302 ? Do we need the intermediate state? Maybe squash the two patches together for simplicity?
clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp | ||
---|---|---|
124 | Sorry, that was an old/intermediate version of the patch. | |
166 | In IgnoreUnlessSpelledInSource mode, ignoringImpCasts(cxxBindTemporaryExpr(has(DefaultConstructor))) simplifies to cxxConstructExpr(isDefaultConstruction()), which is there. |
LGTM!
clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp | ||
---|---|---|
166 | Ah, exactly right, thanks! |
clang-tools-extra/test/clang-tidy/checkers/readability-container-size-empty.cpp | ||
---|---|---|
480–482 | Wait, is losing these diagnostics necessary? |
clang-tools-extra/test/clang-tidy/checkers/readability-container-size-empty.cpp | ||
---|---|---|
480–482 | I think it's an improvement. The noexcept-ness of size() need not relate to the noexcept-ness of empty() (notionally it should, but it's not a requirement users must follow), so there's no guarantee that the change will have the same semantic effect on the declaration of func(). |
It looks like the changes drop the requirement that either operand is 0 or 1 -- is that an oversight or can you explain why that's correct?