Open Quuxplusone opened 9 years ago
Attached AST
(7126 bytes, application/octet-stream): AST generated from my code
From what I can tell after reading the code of this check, the way matchers are
registered implies that this is catching only "direct" mismatch between
arguments. Here, when I look at the AST, there is an implicit conversion
happening from std::pair<const char*, int> to std::pair<std::string, int> which
by no means is detected by this check.
I don't have much experience in writing this kind of semantic checks, but it
seems that it would need to match any function which expects std::string. Then,
the parameter which is of the std::string would have to be tracked down the AST
to get the origin (more than one layer, e.g. implicit conversions, temporaries,
...) of the value. This value, should be checked for a presence of .c_str()
call.
Can someone point to an existing solution which does a similar thing? I am sure
there are some more complex analysis already implemented, which might help in
shaping the solution.
AST
(7126 bytes, application/octet-stream)