Static Function return variable not parsed correctly.

Hello all.

When I am using clang to process a c file, the return type of a static
function cannot be recognized.
For example, I have a function:
static int32_t handle_memory_buttons (int32_t key, double* value)

I use

type_ptr = ND->getResultType().getTypePtr()

to get the return value type info.


returns true. But


returns null and


give me error like:

current parser token 'static'

My other function:

static double execute_operator (int32_t key, double arg1, double arg2)

does not have this issue, I can get double with the dyn_cast.
I have tried to use

type_ptr = ND->getResultType().getUnqualifiedType().getTypePtr()

but still not getting the right return type.

Can anyone help?

int32_t is not a BuiltinType; it is a TypedefType whose underlying type
is a BuiltinType.

Clang does provide functions that ignore this first level of type "sugar":
  type->getAs<...>() // analogous to dyn_cast<...>
  type->castAs<...>() // analogous to cast<...>