Superclass for CallExpr | CXXConstructExpr | ObjCMessageExpr

Hi,

Quite a bit of code in the static analyzer is either duplicated or is using roundabout constructs
to deal in the same way with calls of different type: CallExpr, CXXConstructExpr, ObjCMessageExpr.

What would be the objections against introducing a very simple abstract superclass for those?
Only a few methods would be required:

- arguments() and iterators over those
- return type
- source location

George

We seem to already have expression type in Expr and source location in Stmt. So i guess it's only about arguments.

That seems reasonable to me (though as Artem points out, only arguments() seems relevant). Maybe InvokeExpr? (That matches the terminology the C++ standard uses, at least.)

It’d probably be useful to have a getDirectCallee() member or similar too.

Hi,

Quite a bit of code in the static analyzer is either duplicated or is using roundabout constructs
to deal in the same way with calls of different type: CallExpr, CXXConstructExpr, ObjCMessageExpr.

What would be the objections against introducing a very simple abstract superclass for those?
Only a few methods would be required:

  • arguments() and iterators over those
  • return type
  • source location

That seems reasonable to me (though as Artem points out, only arguments() seems relevant). Maybe InvokeExpr? (That matches the terminology the C++ standard uses, at least.)

I’d suggest avoiding “invoke” just because of the precedent of LLVM’s call vs. invoke. AbstractCallExpr seems reasonable to me.

John.