diff options
Diffstat (limited to 'wrapperhelper/ast.h')
| -rw-r--r-- | wrapperhelper/ast.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/wrapperhelper/ast.h b/wrapperhelper/ast.h index 65e48ffd..2746d988 100644 --- a/wrapperhelper/ast.h +++ b/wrapperhelper/ast.h @@ -25,11 +25,15 @@ #include "gen.h" #include "utils.h" -static void ParseParameter(clang::ASTContext* AST, WrapperGenerator* Gen, clang::ParmVarDecl* Decl, FuncInfo* Func) { +static void ParseParameter(clang::ASTContext* AST, WrapperGenerator* Gen, clang::QualType ParmType, FuncInfo* Func) { using namespace clang; (void)AST; (void)Func; - auto ParmType = Decl->getType(); - if (ParmType->isPointerType()) { + if (ParmType->isFunctionPointerType()) { + auto ProtoType = ParmType->getPointeeType()->getAs<FunctionProtoType>(); + for (unsigned i = 0; i < ProtoType->getNumParams(); i++) { + ParseParameter(AST, Gen, ProtoType->getParamType(i), Func); + } + } else if (ParmType->isPointerType()) { auto PointeeType = ParmType->getPointeeType(); if (PointeeType->isRecordType()) { if (Gen->records.find(StripTypedef(PointeeType)) == Gen->records.end()) { @@ -91,7 +95,7 @@ static void ParseFunction(clang::ASTContext* AST, WrapperGenerator* Gen, clang:: } else { FuncInfo->callback_args[i] = nullptr; } - ParseParameter(AST, Gen, ParmDecl, FuncInfo); + ParseParameter(AST, Gen, ParmDecl->getType(), FuncInfo); } } |