data: function signature handling
* functions will only display their names in the graph view. hovering the nodes shows the signature as a tooltip. However, nodes in the database will be created and used regarding their signature. * improved lambda handling. All calls to generated lambda functions (constructor, call operator) will now point to the lambda class instead. * implemented handling of the "auto" type. * improved the CxxParserTestSuite to use function strings instead of function names for template related functions.
This commit is contained in:
@@ -40,10 +40,10 @@ NameHierarchy CxxDeclNameResolver::getDeclNameHierarchy()
|
||||
LOG_ERROR("unhandled declaration type: " + std::string(m_declaration->getDeclKindName()));
|
||||
}
|
||||
|
||||
contextNameHierarchy = getContextNameHierarchy(m_declaration->getDeclContext());
|
||||
|
||||
if (declName)
|
||||
{
|
||||
contextNameHierarchy = getContextNameHierarchy(m_declaration->getDeclContext());
|
||||
|
||||
if ((clang::isa<clang::NonTypeTemplateParmDecl>(m_declaration) ||
|
||||
clang::isa<clang::TemplateTypeParmDecl>(m_declaration) ||
|
||||
clang::isa<clang::TemplateTemplateParmDecl>(m_declaration)) &&
|
||||
@@ -58,11 +58,6 @@ NameHierarchy CxxDeclNameResolver::getDeclNameHierarchy()
|
||||
contextNameHierarchy.push(declName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const clang::SourceManager& sourceManager = m_declaration->getASTContext().getSourceManager();
|
||||
LOG_ERROR("could not resolve name of decl at: " + m_declaration->getLocation().printToString(sourceManager));
|
||||
}
|
||||
}
|
||||
return contextNameHierarchy;
|
||||
}
|
||||
@@ -153,10 +148,12 @@ std::shared_ptr<NameElement> CxxDeclNameResolver::getDeclName()
|
||||
}
|
||||
else if (recordDecl->isLambda())
|
||||
{
|
||||
// return empty pointer since lambdas will be handled at the level of the individual functions... not optimal.
|
||||
return std::shared_ptr<NameElement>();
|
||||
const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager();
|
||||
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(recordDecl->getLocStart());
|
||||
std::string lambdaName = "lambda at " + std::to_string(presumedBegin.getLine()) + ":" + std::to_string(presumedBegin.getColumn());
|
||||
return std::make_shared<NameElement>(lambdaName, lambdaName);
|
||||
}
|
||||
else if (!recordDecl->isLambda() && declNameString.size() == 0)
|
||||
else if (declNameString.size() == 0)
|
||||
{
|
||||
const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager();
|
||||
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(declaration->getLocStart());
|
||||
@@ -170,10 +167,8 @@ std::shared_ptr<NameElement> CxxDeclNameResolver::getDeclName()
|
||||
{
|
||||
if (methodDecl->getParent()->isLambda())
|
||||
{
|
||||
const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager();
|
||||
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(methodDecl->getParent()->getLocStart());
|
||||
std::string lambdaName = "lambda at " + std::to_string(presumedBegin.getLine()) + ":" + std::to_string(presumedBegin.getColumn());
|
||||
return std::make_shared<NameElement>(lambdaName, lambdaName);
|
||||
// return empty pointer since lambdas will be handled at the level of the parent class... not optimal.
|
||||
return std::shared_ptr<NameElement>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +224,7 @@ std::shared_ptr<NameElement> CxxDeclNameResolver::getDeclName()
|
||||
parameterString += ")";
|
||||
|
||||
return std::make_shared<NameElement>(
|
||||
functionName + parameterString + (isConst ? "const" : ""),
|
||||
functionName,
|
||||
(isStatic ? "static " : "") + returnTypeString + " " + functionName + parameterString + (isConst ? " const" : ""));
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +178,12 @@ std::shared_ptr<DataType> CxxTypeNameResolver::typeToDataType(const clang::Type*
|
||||
dataType = qualTypeToDataType(packExpansionType->getPattern());
|
||||
break;
|
||||
}
|
||||
case clang::Type::Auto:
|
||||
{
|
||||
const clang::AutoType* autoType = clang::dyn_cast<clang::AutoType>(type);
|
||||
dataType = qualTypeToDataType(autoType->getDeducedType());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
LOG_INFO(std::string("Unhandled kind of type encountered: ") + type->getTypeClassName());
|
||||
|
||||
Reference in New Issue
Block a user