Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions plugins/cpp/parser/src/clangastvisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,57 @@ class ClangASTVisitor : public clang::RecursiveASTVisitor<ClangASTVisitor>

return true;
}

bool VisitUsingDecl(clang::UsingDecl* ud_)
{
//--- CppAstNode ---//

model::CppAstNodePtr astNode = std::make_shared<model::CppAstNode>();

astNode->astValue = getSourceText(
_clangSrcMgr,
ud_->getBeginLoc(),
ud_->getLocation(),
true);
astNode->location = getFileLoc(ud_->getBeginLoc(), ud_->getEndLoc());
astNode->entityHash = util::fnvHash(getUSR(ud_));
astNode->symbolType = model::CppAstNode::SymbolType::Other;
astNode->astType = model::CppAstNode::AstType::Usage;

astNode->id = model::createIdentifier(*astNode);

if (insertToCache(ud_, astNode))
_astNodes.push_back(astNode);

return true;
}

bool VisitUsingDirectiveDecl(clang::UsingDirectiveDecl* udd_)
{
//--- CppAstNode ---//

model::CppAstNodePtr astNode = std::make_shared<model::CppAstNode>();

const clang::NamespaceDecl* nd = udd_->getNominatedNamespace();

astNode->astValue = getSourceText(
_clangSrcMgr,
udd_->getBeginLoc(),
udd_->getLocation(),
true);
astNode->location = getFileLoc(udd_->getBeginLoc(), udd_->getEndLoc());
astNode->entityHash = util::fnvHash(getUSR(nd));
astNode->symbolType = model::CppAstNode::SymbolType::Namespace;
astNode->astType = model::CppAstNode::AstType::Usage;

astNode->id = model::createIdentifier(*astNode);

if (insertToCache(udd_, astNode))
_astNodes.push_back(astNode);

return true;
}

bool VisitCXXConstructExpr(clang::CXXConstructExpr* ce_)
{
model::CppAstNodePtr astNode = std::make_shared<model::CppAstNode>();
Expand Down