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

Aaron Ballman via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 26 13:58:22 PDT 2015


On Wed, Aug 26, 2015 at 4:56 PM, Alexander Droste via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> Hi everyone,
>
> is it possible to get the type of a clang::Expr instance
> the expression evaluates to?

You should be able to use clang::Expr::getType().

~Aaron

> 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
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list