Skip to content

Commit 5640c86

Browse files
committed
Ast visitor function for using declarations.
1 parent b5c5bcc commit 5640c86

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

plugins/cpp/parser/src/clangastvisitor.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,33 @@ class ClangASTVisitor : public clang::RecursiveASTVisitor<ClangASTVisitor>
956956

957957
return true;
958958
}
959+
960+
961+
962+
bool VisitUsingDecl(clang::UsingDecl* ud_)
963+
{
964+
965+
//--- CppAstNode ---//
966+
967+
model::CppAstNodePtr astNode = std::make_shared<model::CppAstNode>();
968+
969+
astNode->astValue = getSourceText(
970+
_clangSrcMgr,
971+
ud_->getBeginLoc(),
972+
ud_->getLocation(),
973+
true);
974+
std::string usr = getUSR(ud_);
975+
astNode->location = getFileLoc(ud_->getBeginLoc(), ud_->getEndLoc());
976+
astNode->entityHash = util::fnvHash(usr);
977+
astNode->astType = model::CppAstNode::AstType::Definition;
978+
astNode->id = model::createIdentifier(*astNode);
979+
980+
if (insertToCache(ud_, astNode))
981+
_astNodes.push_back(astNode);
982+
983+
return true;
984+
}
985+
959986

960987
bool VisitCXXConstructExpr(clang::CXXConstructExpr* ce_)
961988
{

0 commit comments

Comments
 (0)