[PATCH] D27806: [clang-tidy] Add obvious-invalid-range
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 19 09:52:14 PST 2016
aaron.ballman added inline comments.
================
Comment at: clang-tidy/obvious/InvalidRangeCheck.cpp:20-36
+ "std::for_each; std::find; std::find_if; std::find_end; "
+ "std::find_first_of; std::adjacent_find; std::count; std::count_if;"
+ "std::mismatch; std::equal; std::search; std::copy; "
+ "std::copy_backward; std::swap_ranges; std::transform; std::replace"
+ "std::replace_if; std::replace_copy; std::replace_copy_if; std::fill; "
+ "std::fill_n; std::generate; std::generate_n; std::remove; std::remove_if"
+ "std::remove_copy; std::remove_copy_if; std::unique; std::unique_copy;"
----------------
Prazek wrote:
> Prazek wrote:
> > sbarzowski wrote:
> > > Prazek wrote:
> > > > sbarzowski wrote:
> > > > > I would go with one per line. It will be much more diff-friendly this way. And also much easier to add stuff in the middle and maybe keep it sorted.
> > > > I don't expect this list to change in any way in the future, and it already take more than 20 lines. I don't want to put about 80 lines only to define the names
> > > Ok, I don't think it's important enough to argue about it if it was your deliberate decision.
> > >
> > > But I still think your argument is invalid :-). If anything that calls for putting it in a separate file.
> > By moving it to another file I would expose it to other checks, which is not my intention.
> > I also want to keep this simple and short, and by making this list less readable (which is not something that some next developer should care about) I make the whole file more readable, because it is shorter.
> ok I think I will remove the list and instead will check if the name starts with std::, because if someone calls std::.
You should check if the canonical name starts with `::std::`, otherwise you may run into issues with:
```
namespace my {
namespace std {
// bad code goes here
}
}
```
https://reviews.llvm.org/D27806
More information about the cfe-commits
mailing list