[cfe-commits] [Patch][Review Request]Fix for PR7287
dgregor at apple.com
Tue Nov 2 07:01:16 PDT 2010
On Nov 1, 2010, at 5:51 PM, Ted Kremenek <kremenek at apple.com> wrote:
> On Nov 1, 2010, at 5:28 PM, Douglas Gregor wrote:
>> On Nov 1, 2010, at 5:19 PM, Ted Kremenek wrote:
>>> I disagree. Most checkers don't care about such functions.
>> Those checkers are making assumptions that don't hold in C++, where not all names are simple identifiers. The rest of the front end has been updated to cope with DeclarationName and it hasn't ever been a problem. Why now?
> Checkers are very different from the logic in Sema. They only care about specific, domain-specific idioms. The scope of things they care or need to think about is limited. Why expand that beyond necessity?
The original limits were, basically, things that C can do, because C++ wasn't around. So, I am not arguing that there should be no limits: I'm arguing that the original C-flavored limits are unnatural.
> For functions that monitor function calls (which is only a subset of them), they primarily care about monitoring for functions like 'lock()', 'unlock()', etc. They don't need to think about everything.
Sure, but why special-case simple function names? I'd bet that checkers looking at function names don't check for the context of the function (translation unit vs. namespace vs. class) or, if it was an overloaded function, that we have the correct signature. Shall we limit those, too?
Why is a checker that looks at, say, attributes on callee functions more complicated than one that looks at names? The AST is simple in both cases, but you are suggesting that the former require the advanced interface while the latter uses the simpler one... even though, based on the issues I mentioned above, it's more likely that the former will actually work :)
> For Checkers that care about monitoring all of these cases, we do have a Checker::VisitGenericCallExpr() that they can implement
Sure, but the same question crops up again: what defines the simple case, and why?
I could imagine that the simple interface would be for C functions only, filtering out anything with C++ linkage. That would be a reasonable answer.
More information about the cfe-commits