logic: recording symbol kinds cxx name specifiers (e.g. "std" in "std::string")
This commit is contained in:
@@ -1,6 +1,49 @@
|
|||||||
Token.cpp ERROR: Location Id was not referenced by this Token.
|
Token.cpp ERROR: Location Id was not referenced by this Token.
|
||||||
Node.cpp WARNING: Cannot change NodeType after it was already set from namespace to class
|
Node.cpp WARNING: Cannot change NodeType after it was already set from namespace to class
|
||||||
Edge.cpp ERROR: Nodes are not plain copies.
|
Edge.cpp ERROR: Nodes are not plain copies.
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
|
INFO: Indexer - indexing source file: input.cc
|
||||||
INFO: send MessageStatus Enabled console and file logging.
|
INFO: send MessageStatus Enabled console and file logging.
|
||||||
INFO: send TestMessage
|
INFO: send TestMessage
|
||||||
INFO: send TestMessage
|
INFO: send TestMessage
|
||||||
@@ -29,46 +72,3 @@ TextAccess.cpp WARNING: Line numbers start with one, is 0
|
|||||||
TextAccess.cpp WARNING: Line numbers start with one, is 0
|
TextAccess.cpp WARNING: Line numbers start with one, is 0
|
||||||
TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 2:3 2:1
|
TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 2:3 2:1
|
||||||
TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 4:1 1:10
|
TokenLocationCollection.cpp ERROR: TokenLocation has wrong boundaries: file.c 4:1 1:10
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
INFO: Indexer - indexing source file: input.cc
|
|
||||||
|
|||||||
@@ -209,10 +209,6 @@ void HierarchyCache::addFirstChildIdsForNodeId(Id nodeId, std::vector<Id>* nodeI
|
|||||||
{
|
{
|
||||||
node->addChildIds(nodeIds);
|
node->addChildIds(nodeIds);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
nodeIds->push_back(nodeId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HierarchyCache::addFirstVisibleChildIdsForNodeId(Id nodeId, std::vector<Id>* nodeIds) const
|
void HierarchyCache::addFirstVisibleChildIdsForNodeId(Id nodeId, std::vector<Id>* nodeIds) const
|
||||||
|
|||||||
@@ -281,8 +281,26 @@ bool CxxAstVisitor::TraverseTemplateTemplateParmDecl(clang::TemplateTemplateParm
|
|||||||
|
|
||||||
bool CxxAstVisitor::TraverseNestedNameSpecifierLoc(clang::NestedNameSpecifierLoc loc)
|
bool CxxAstVisitor::TraverseNestedNameSpecifierLoc(clang::NestedNameSpecifierLoc loc)
|
||||||
{
|
{
|
||||||
// just skip all qualifiers (for now)
|
bool ret = true;
|
||||||
return true;
|
if (loc)
|
||||||
|
{
|
||||||
|
for (auto it = m_components.begin(); it != m_components.end(); it++)
|
||||||
|
{
|
||||||
|
(*it)->beginTraverseNestedNameSpecifierLoc(loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
//todo: call method of base class...
|
||||||
|
if (clang::NestedNameSpecifierLoc prefix = loc.getPrefix())
|
||||||
|
{
|
||||||
|
ret = TraverseNestedNameSpecifierLoc(prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto it = m_components.rbegin(); it != m_components.rend(); it++)
|
||||||
|
{
|
||||||
|
(*it)->endTraverseNestedNameSpecifierLoc(loc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CxxAstVisitor::TraverseConstructorInitializer(clang::CXXCtorInitializer* init)
|
bool CxxAstVisitor::TraverseConstructorInitializer(clang::CXXCtorInitializer* init)
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ DEF_TRAVERSE_TYPE_PTR(UnresolvedLookupExpr)
|
|||||||
virtual void beginTraverseTemplateDefaultArgumentLoc() {}
|
virtual void beginTraverseTemplateDefaultArgumentLoc() {}
|
||||||
virtual void endTraverseTemplateDefaultArgumentLoc() {}
|
virtual void endTraverseTemplateDefaultArgumentLoc() {}
|
||||||
|
|
||||||
|
DEF_TRAVERSE_TYPE(NestedNameSpecifierLoc)
|
||||||
|
|
||||||
DEF_TRAVERSE_CUSTOM_TYPE_PTR(ConstructorInitializer, CXXCtorInitializer)
|
DEF_TRAVERSE_CUSTOM_TYPE_PTR(ConstructorInitializer, CXXCtorInitializer)
|
||||||
|
|
||||||
DEF_TRAVERSE_TYPE_PTR(CXXTemporaryObjectExpr)
|
DEF_TRAVERSE_TYPE_PTR(CXXTemporaryObjectExpr)
|
||||||
|
|||||||
@@ -26,6 +26,68 @@ CxxAstVisitorComponentIndexer::~CxxAstVisitorComponentIndexer()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CxxAstVisitorComponentIndexer::beginTraverseNestedNameSpecifierLoc(const clang::NestedNameSpecifierLoc loc)
|
||||||
|
{
|
||||||
|
switch (loc.getNestedNameSpecifier()->getKind())
|
||||||
|
{
|
||||||
|
case clang::NestedNameSpecifier::Identifier:
|
||||||
|
break;
|
||||||
|
case clang::NestedNameSpecifier::Namespace:
|
||||||
|
m_client->recordSymbol(
|
||||||
|
getAstVisitor()->getDeclNameCache()->getValue(loc.getNestedNameSpecifier()->getAsNamespace()),
|
||||||
|
SYMBOL_NAMESPACE,
|
||||||
|
ACCESS_NONE,
|
||||||
|
DEFINITION_NONE
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case clang::NestedNameSpecifier::NamespaceAlias:
|
||||||
|
m_client->recordSymbol(
|
||||||
|
getAstVisitor()->getDeclNameCache()->getValue(loc.getNestedNameSpecifier()->getAsNamespaceAlias()),
|
||||||
|
SYMBOL_NAMESPACE,
|
||||||
|
ACCESS_NONE,
|
||||||
|
DEFINITION_NONE
|
||||||
|
);
|
||||||
|
m_client->recordSymbol(
|
||||||
|
getAstVisitor()->getDeclNameCache()->getValue(loc.getNestedNameSpecifier()->getAsNamespaceAlias()->getAliasedNamespace()),
|
||||||
|
SYMBOL_NAMESPACE,
|
||||||
|
ACCESS_NONE,
|
||||||
|
DEFINITION_NONE
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case clang::NestedNameSpecifier::Global:
|
||||||
|
case clang::NestedNameSpecifier::Super:
|
||||||
|
break;
|
||||||
|
case clang::NestedNameSpecifier::TypeSpec:
|
||||||
|
case clang::NestedNameSpecifier::TypeSpecWithTemplate:
|
||||||
|
if (const clang::CXXRecordDecl* recordDecl = loc.getNestedNameSpecifier()->getAsRecordDecl())
|
||||||
|
{
|
||||||
|
SymbolKind symbolKind = SYMBOL_KIND_MAX;
|
||||||
|
if (recordDecl->isClass())
|
||||||
|
{
|
||||||
|
symbolKind = SYMBOL_CLASS;
|
||||||
|
}
|
||||||
|
else if (recordDecl->isStruct())
|
||||||
|
{
|
||||||
|
symbolKind = SYMBOL_STRUCT;
|
||||||
|
}
|
||||||
|
else if (recordDecl->isUnion())
|
||||||
|
{
|
||||||
|
symbolKind = SYMBOL_UNION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (symbolKind != SYMBOL_KIND_MAX)
|
||||||
|
{
|
||||||
|
m_client->recordSymbol(
|
||||||
|
getAstVisitor()->getDeclNameCache()->getValue(recordDecl),
|
||||||
|
symbolKind,
|
||||||
|
ACCESS_NONE,
|
||||||
|
DEFINITION_NONE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CxxAstVisitorComponentIndexer::beginTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc)
|
void CxxAstVisitorComponentIndexer::beginTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public:
|
|||||||
CxxAstVisitorComponentIndexer(CxxAstVisitor* astVisitor, clang::ASTContext* astContext, ParserClient* client, FileRegister* fileRegister);
|
CxxAstVisitorComponentIndexer(CxxAstVisitor* astVisitor, clang::ASTContext* astContext, ParserClient* client, FileRegister* fileRegister);
|
||||||
virtual ~CxxAstVisitorComponentIndexer();
|
virtual ~CxxAstVisitorComponentIndexer();
|
||||||
|
|
||||||
|
virtual void beginTraverseNestedNameSpecifierLoc(const clang::NestedNameSpecifierLoc loc);
|
||||||
virtual void beginTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc);
|
virtual void beginTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc);
|
||||||
virtual void beginTraverseLambdaCapture(clang::LambdaExpr *lambdaExpr, const clang::LambdaCapture *capture);
|
virtual void beginTraverseLambdaCapture(clang::LambdaExpr *lambdaExpr, const clang::LambdaCapture *capture);
|
||||||
|
|
||||||
|
|||||||
@@ -3322,7 +3322,7 @@ public:
|
|||||||
TS_ASSERT_EQUALS(client.errors.size(), 0);
|
TS_ASSERT_EQUALS(client.errors.size(), 0);
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(client.typedefs.size(), 1);
|
TS_ASSERT_EQUALS(client.typedefs.size(), 1);
|
||||||
TS_ASSERT_EQUALS(client.classes.size(), 4);
|
TS_ASSERT_EQUALS(client.classes.size(), 5);
|
||||||
TS_ASSERT_EQUALS(client.enums.size(), 1);
|
TS_ASSERT_EQUALS(client.enums.size(), 1);
|
||||||
TS_ASSERT_EQUALS(client.enumConstants.size(), 2);
|
TS_ASSERT_EQUALS(client.enumConstants.size(), 2);
|
||||||
TS_ASSERT_EQUALS(client.functions.size(), 5); // used methods are also recorded as functions (these get overridden in the intermediate storage)
|
TS_ASSERT_EQUALS(client.functions.size(), 5); // used methods are also recorded as functions (these get overridden in the intermediate storage)
|
||||||
|
|||||||
Reference in New Issue
Block a user