[PATCH] D91303: [clang-tidy] readability-container-size-empty: simplify implementation

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 20 07:07:31 PST 2021


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-container-size-empty.cpp:480-482
-// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: the 'empty' method should be used
-// CHECK-MESSAGES: :101:18: note: method 'Lazy'::empty() defined here
-// CHECK-FIXES: {{^  }}void func() noexcept(!L.empty());
----------------
alexfh wrote:
> Wait, is losing these diagnostics necessary?
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()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91303/new/

https://reviews.llvm.org/D91303



More information about the cfe-commits mailing list