clang cast callExpr.getArg type to decl

153 Views Asked by At

i want to implement a interpreter based on Clang.i meet a problem. i creat a map to store vardecl and it corresponding int value. but when i visit callExpr,the function callExpr.getArg return type is expr,i want to cast it to decl type. how can i figure this problem?

example

int a = 10;
int main(){
  PRINT(a) //self-define function
}

mymapdecl[a] = 10,but PRINTExpr.getArg type is expr. I use dyn_cast<DeclRefExpr>(left)to get DeclRefExpr type,but it return null pointer.

0

There are 0 best solutions below