Browse Source

Added Signature property to functions that provide the original function signature as accurately as possible from the original source.

pull/86/head
triton 12 years ago
parent
commit
8afb0acd19
  1. 4
      src/AST/Function.cs
  2. 9
      src/Parser/Parser.cpp

4
src/AST/Function.cs

@ -168,7 +168,9 @@ namespace CppSharp.AST @@ -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<T>(IDeclVisitor<T> visitor)
{
return visitor.VisitFunctionDecl(this);

9
src/Parser/Parser.cpp

@ -1574,8 +1574,17 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, CppSharp::AST::Function^ F, @@ -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<clix::E_UTF8>(Sig);
for(auto it = FD->param_begin(); it != FD->param_end(); ++it)
{
ParmVarDecl* VD = (*it);

Loading…
Cancel
Save