[PATCH] D50488: [Analyzer] Checker for non-determinism caused by sorting of pointer-like elements
Mandeep Singh Grang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 5 11:09:29 PDT 2018
mgrang added a comment.
In https://reviews.llvm.org/D50488#1224480, @martong wrote:
> From this little information I have hear are my thoughts:
>
> > match callExpr(allOf (callee(functionDecl(hasName("std::sort"))), hasArgument(0, hasDescendant(declRefExpr(to(fieldDecl(hasName("value_type"))))))))))
>
> I think this is a good direction, but keep in mind that `value_type` is a typedef, thus you should use the `typedefNameDecl` matcher instead of the `fieldDecl`.
Thanks @martong Yes, I tried another matcher with typedefNameDecl which also did not match:
match callExpr(allOf (callee(functionDecl(hasName("std::sort"))), hasArgument(0, stmt(hasDescendant(expr(hasType(typedefType(hasDeclaration(typedefNameDecl(hasName("value_type")))))))))))
> (Also if I understand correctly then this is good that this matcher does not match in case of the `intPointerArray` example, because the array does not have any member at all ...)
How then do you think I should try matching the IntPointerArray example? I am now leaning towards not doing this via AST Matchers as I am not sure if I can easily match more complex cases.
Repository:
rC Clang
https://reviews.llvm.org/D50488
More information about the cfe-commits
mailing list