[cfe-dev] How to get the type clang::Expr evaluates to?

Alexander Droste via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 26 13:56:03 PDT 2015


Hi everyone,

is it possible to get the type of a clang::Expr instance
the expression evaluates to? I would like to use this, to find out
what kind of types arguments passed to a clang::CallExpr have.

Sth. like this:

int n;
function(&n);
..
// getArg() returns Expr
callExpr()->getArg(idx)--->getTypeExprEvaluatesTo(); // -> *int

or with multiple operands:
int n;
function(1 + n);
..
callExpr()->getArg(idx)--->getTypeExprEvaluatesTo(); // -> int

-Alex



More information about the cfe-dev mailing list