From 92243be28ff19a2a065262621a68150e4587bf96 Mon Sep 17 00:00:00 2001 From: triton Date: Wed, 21 Aug 2013 08:05:49 +0100 Subject: [PATCH] Make the parsing of function codegen info a bit more robust. --- src/Parser/Parser.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Parser/Parser.cpp b/src/Parser/Parser.cpp index ade79b4b..4f31cd5a 100644 --- a/src/Parser/Parser.cpp +++ b/src/Parser/Parser.cpp @@ -1604,7 +1604,12 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, CppSharp::AST::Function^ F, ParamStartLoc = VD->getLocEnd(); } - if (FD->isThisDeclarationADefinition() && !FD->isDependentContext()) + bool CheckCodeGenInfo = !FD->isDependentContext(); + if (auto RT = FD->getResultType()->getAs()) + if (auto RD = RT->getAsCXXRecordDecl()) + CheckCodeGenInfo &= RD->hasDefinition(); + + if (CheckCodeGenInfo) { auto& CGInfo = GetCodeGenFuntionInfo(CodeGenTypes, FD); F->IsReturnIndirect = CGInfo.getReturnInfo().isIndirect();