Clang import; Ensure function pointer is created

This commit is contained in:
Daniel Marjamäki 2020-04-12 20:34:05 +02:00
parent 6b579293b6
commit 97f5c5767e
1 changed files with 5 additions and 4 deletions

View File

@ -1067,16 +1067,17 @@ void clangimport::AstNode::createTokensFunctionDecl(TokenList *tokenList)
Token *nameToken = addtoken(tokenList, getSpelling() + getTemplateParameters()); Token *nameToken = addtoken(tokenList, getSpelling() + getTemplateParameters());
Scope *nestedIn = const_cast<Scope *>(nameToken->scope()); Scope *nestedIn = const_cast<Scope *>(nameToken->scope());
if (!prev) { if (prev) {
const std::string addr = *(std::find(mExtTokens.begin(), mExtTokens.end(), "prev") + 1);
mData->ref(addr, nameToken);
}
if (!nameToken->function()) {
nestedIn->functionList.push_back(Function(nameToken)); nestedIn->functionList.push_back(Function(nameToken));
mData->funcDecl(mExtTokens.front(), nameToken, &nestedIn->functionList.back()); mData->funcDecl(mExtTokens.front(), nameToken, &nestedIn->functionList.back());
if (nodeType == CXXConstructorDecl) if (nodeType == CXXConstructorDecl)
nestedIn->functionList.back().type = Function::Type::eConstructor; nestedIn->functionList.back().type = Function::Type::eConstructor;
else if (nodeType == CXXDestructorDecl) else if (nodeType == CXXDestructorDecl)
nestedIn->functionList.back().type = Function::Type::eDestructor; nestedIn->functionList.back().type = Function::Type::eDestructor;
} else {
const std::string addr = *(std::find(mExtTokens.begin(), mExtTokens.end(), "prev") + 1);
mData->ref(addr, nameToken);
} }
Function * const function = const_cast<Function*>(nameToken->function()); Function * const function = const_cast<Function*>(nameToken->function());