diff --git a/src/AST/Function.cs b/src/AST/Function.cs index f9dba774..60ef944c 100644 --- a/src/AST/Function.cs +++ b/src/AST/Function.cs @@ -168,7 +168,9 @@ namespace CppSharp.AST public Function OriginalFunction { get; set; } public string Mangled { get; set; } - + + public string Signature { get; set; } + public override T Visit(IDeclVisitor visitor) { return visitor.VisitFunctionDecl(this); diff --git a/src/Parser/Parser.cpp b/src/Parser/Parser.cpp index 2d428e5e..e85b3ea5 100644 --- a/src/Parser/Parser.cpp +++ b/src/Parser/Parser.cpp @@ -1574,8 +1574,17 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, CppSharp::AST::Function^ F, assert (!FTInfo.isNull()); ParamStartLoc = FTInfo.getRParenLoc(); + ResultLoc = FTInfo.getResultLoc().getLocStart(); } + clang::SourceRange Range(FD->getLocStart(), ParamStartLoc); + if (ResultLoc.isValid()) + Range.setBegin(ResultLoc); + + std::string Sig; + if (GetDeclText(Range, Sig)) + F->Signature = clix::marshalString(Sig); + for(auto it = FD->param_begin(); it != FD->param_end(); ++it) { ParmVarDecl* VD = (*it);