alexfh added a comment. In https://reviews.llvm.org/D35372#810457, @alexfh wrote:
> I have deja vu ;) > > Should we make a single check for all CLOEXEC and friends with a single > configurable list of (function name, flag name) pairs? Okay, it may be a bit more complicated than just a list of function name -> flag name mappings, since we have to take in account the argument position as well. We also might want to check the signature to a certain degree to avoid matching wrong function. There are multiple approaches possible to rule out incorrect functions with the same name: 1. just look at the number of arguments - this might well be enough, since for a certain codebase I wouldn't expect multiple `memfd_create`'s etc. It would allow user configurability of the function -> flag mappings. 2. encode the types of arguments as strings and have a small dictionary of matchers in the check (e.g. `"const char*" -> pointerType(pointee(isAnyCharacter()))`) - that will be more precise and still quite flexible and also allow user-configurable function -> flag mappings. But this mechanism may be an overkill, if we don't anticipate user-configurable functions. I don't know how complex the resulting code turns out to be. 3. Add a matcher for each function statically. This would obviously allow for arbitrarily complex matchers, but won't be extensible via configuration options. https://reviews.llvm.org/D35372 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits