[PATCH] D22725: [clang-tidy] Add check 'misc-replace-memcpy'

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 24 15:21:27 PDT 2016


Prazek added a comment.

In https://reviews.llvm.org/D22725#494168, @JDevlieghere wrote:

> In https://reviews.llvm.org/D22725#494167, @Prazek wrote:
>
> > hmm It seems that I mislead you, I suck at C api - memmove source and destination can overlap, but std::move can't. So I guess you have to remove the memmove support. Sorry.
>
>
> No problem, I wasn't aware of the issue either, so thanks for letting me know!
>
> While running my check on the LLVM repo I ran into another issue: can't do pointer arithmetic when the arguments to memcpy are void pointers. I will look into updating my matchers to exclude this particular case.


Yep, developing clang-tidy checks is mostly about trying to find out all the cases, and then finding that there are 3x more corner cases after running it on LLVM :)
btw I recommend compiling on Release with enabled assertions (-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON). Usually you don't need debug info while developing clang-tidy because it doesn't crash that often and Release is at least 4x faster than RelWithDebInfo (and even more than Debug), so it actually make sense to recompile everything and run it than to wait for clang-tidy compiled with debug.


https://reviews.llvm.org/D22725





More information about the cfe-commits mailing list