[PATCH] D39121: [clang-tidy] Misplaced Operator in Strlen in Alloc

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 25 02:19:58 PDT 2017

baloghadamsoftware added a comment.

In https://reviews.llvm.org/D39121#902121, @martong wrote:

> Consider the use of a function pointer:
>   void* malloc(int);
>   int strlen(char*);
>   auto fp = malloc;
>   void bad_malloc(char *str) { char *c = (char *)fp(strlen(str + 1)); }
> I think, the checker will not match in this case.
> One might use allocation functions via a function pointer in case of more possible allocation strategies (e.g having a different strategy for a shared memory allocation).

Good point! But I think we should keep this first patch small, so I will do it in a follow-up patch.


More information about the cfe-commits mailing list