[cfe-dev] Type of Array ParmVarDecl becomes PointerType

Eli Friedman eli.friedman at gmail.com
Thu Dec 22 09:05:20 PST 2011


On Thu, Dec 22, 2011 at 1:57 AM, Peter <clang_llvm_123-4 at yahoo.de> wrote:
> Hi everybody,
>
> I am using Version 3.0 and I am trying to parse the parameter of the
> following function declaration.
>
> void test(int myParam[])
> {
>
>
> }
>
> I have written an ASTVisitor to iterate over the "ParamDecl's"of  my
> "FunctionDecl's"
> The type of the "ParmVarDecl" myParam is always a "PointerType", although I
> am expecting
> an "ArrayType". Is this normal behavior?

Yes, that's how C works; for most purposes, the original type doesn't
matter.  You can use ParmVarDecl::getOriginalType() if you really need
it.

-Eli




More information about the cfe-dev mailing list