diff --git a/plugins/cpp/parser/src/clangastvisitor.h b/plugins/cpp/parser/src/clangastvisitor.h index 699d6334f..306b9c360 100644 --- a/plugins/cpp/parser/src/clangastvisitor.h +++ b/plugins/cpp/parser/src/clangastvisitor.h @@ -956,7 +956,57 @@ class ClangASTVisitor : public clang::RecursiveASTVisitor return true; } + + bool VisitUsingDecl(clang::UsingDecl* ud_) + { + //--- CppAstNode ---// + + model::CppAstNodePtr astNode = std::make_shared(); + + 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(); + + 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();