[analyser] memset arguments checker

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[analyser] memset arguments checker

Alex Denisov via cfe-dev
Hi all

I have an idea for memset checker for handling accidental args swap such as:

struct A { ... };
...
struct A a;
memset(&a, sizeof(struct A), 0); // expected-warning {{possibly wrong order of arguments 'sizeof(struct A)' and '0' passed as arguments 'value' and 'num'}}
...

Probably it can be AST checker but in some cases it can be more precise if it would be extension of CStringChecker. Any suggestions in which way is more robust for such checker.

Thanks, Alexey K

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [analyser] memset arguments checker

Alex Denisov via cfe-dev
On 13 December 2017 at 12:54, Alexey Knyshev via cfe-dev
<[hidden email]> wrote:
> I have an idea for memset checker for handling accidental args swap such as:

clang-tidy has this check:
https://clang.llvm.org/extra/clang-tidy/checks/bugprone-suspicious-memset-usage.html

--
Malcolm Parsons
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [analyser] memset arguments checker

Alex Denisov via cfe-dev
Hm, ok. Thanks, Malcolm!

2017-12-13 16:25 GMT+03:00 Malcolm Parsons <[hidden email]>:
On 13 December 2017 at 12:54, Alexey Knyshev via cfe-dev
<[hidden email]> wrote:
> I have an idea for memset checker for handling accidental args swap such as:

clang-tidy has this check:
https://clang.llvm.org/extra/clang-tidy/checks/bugprone-suspicious-memset-usage.html

--
Malcolm Parsons



--

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev