logic: record template argument that is a dependent template type as local symbol
This commit is contained in:
committed by
Eberhard Graether
parent
fc0e652ae0
commit
ce22e5917a
@@ -50,7 +50,10 @@ void ParserClientImpl::recordDefinitionKind(Id symbolId, DefinitionKind definiti
|
||||
Id ParserClientImpl::recordReference(ReferenceKind referenceKind, Id referencedSymbolId, Id contextSymbolId, const ParseLocation& location)
|
||||
{
|
||||
Id edgeId = addEdge(referenceKindToEdgeType(referenceKind), contextSymbolId, referencedSymbolId);
|
||||
addSourceLocation(edgeId, location, LOCATION_TOKEN);
|
||||
if (edgeId)
|
||||
{
|
||||
addSourceLocation(edgeId, location, LOCATION_TOKEN);
|
||||
}
|
||||
return edgeId;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,26 +96,35 @@ void CxxAstVisitorComponentIndexer::beginTraverseTemplateArgumentLoc(const clang
|
||||
{
|
||||
// TODO: maybe move this to VisitTemplateName
|
||||
|
||||
const Id symbolId = getOrCreateSymbolId(loc.getArgument().getAsTemplate().getAsTemplateDecl());
|
||||
const clang::TemplateName templateTemplateArgumentName = loc.getArgument().getAsTemplate();
|
||||
|
||||
const ParseLocation parseLocation = getParseLocation(loc.getLocation());
|
||||
|
||||
m_client->recordReference(
|
||||
REFERENCE_TYPE_USAGE,
|
||||
symbolId,
|
||||
getOrCreateSymbolId(getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getContext()),
|
||||
parseLocation
|
||||
);
|
||||
|
||||
if (templateTemplateArgumentName.isDependent())
|
||||
{
|
||||
const clang::NamedDecl* namedContextDecl = getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl(1);
|
||||
if (namedContextDecl)
|
||||
m_client->recordLocalSymbol(getLocalSymbolName(templateTemplateArgumentName.getAsTemplateDecl()->getLocation()), parseLocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Id symbolId = getOrCreateSymbolId(templateTemplateArgumentName.getAsTemplateDecl());
|
||||
|
||||
m_client->recordReference(
|
||||
REFERENCE_TYPE_USAGE,
|
||||
symbolId,
|
||||
getOrCreateSymbolId(getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getContext()),
|
||||
parseLocation
|
||||
);
|
||||
|
||||
{
|
||||
m_client->recordReference(
|
||||
REFERENCE_TYPE_USAGE,
|
||||
symbolId,
|
||||
getOrCreateSymbolId(namedContextDecl), // we use the closest named decl here (e.g. function decl)
|
||||
parseLocation
|
||||
);
|
||||
const clang::NamedDecl* namedContextDecl = getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl(1);
|
||||
if (namedContextDecl)
|
||||
{
|
||||
m_client->recordReference(
|
||||
REFERENCE_TYPE_USAGE,
|
||||
symbolId,
|
||||
getOrCreateSymbolId(namedContextDecl), // we use the closest named decl here (e.g. function decl)
|
||||
parseLocation
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3641,7 +3641,7 @@ public:
|
||||
client->typeUses, L"B<A, template<typename> typename U> -> A<typename T> <8:9 8:9>"
|
||||
));
|
||||
TS_ASSERT(utility::containsElement<std::wstring>(
|
||||
client->typeUses, L"B<A, template<typename> typename U> -> B<A, template<typename> typename U>::U<typename> <8:12 8:12>"
|
||||
client->localSymbols, L"input.cc<7:36> <8:12 8:12>"
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user