Declarations for callable objects: BlockDecl, FunctionDecl, ObjCMethodDecl share quite a few methods:
- parameters()
- getSourceRange()
- getBody()
and some others.
Despite that, they don’t have any super-interface (CallableDecl?).
As a result, I often find myself writing duplicating code. Clang static analyzer has a CallEvent struct which partially mitigates the issue, but
1) In some cases, it’s not suitable
2) CallEvent itself has duplication
Would anyone be against introducing a common interface for those classes?
It could be as tiny change as just adding an inheritance, and then users would be able to do
if (auto *CD = dyn_cast<CallableDecl>(D))
D->parameters() // …
Declarations for callable objects: BlockDecl, FunctionDecl, ObjCMethodDecl share quite a few methods:
parameters()
getSourceRange()
getBody()
and some others.
Despite that, they don’t have any super-interface (CallableDecl?).
CodeGenFunction has AbstractCallee. Maybe that could be extended to suit your needs?
As a result, I often find myself writing duplicating code. Clang static analyzer has a CallEvent struct which partially mitigates the issue, but
In some cases, it’s not suitable
CallEvent itself has duplication
Would anyone be against introducing a common interface for those classes?
It could be as tiny change as just adding an inheritance, and then users would be able to do