|
25 | 25 | #include <model/cppinheritance-odb.hxx> |
26 | 26 | #include <model/cppnamespace.h> |
27 | 27 | #include <model/cppnamespace-odb.hxx> |
| 28 | +#include <model/cppnamespacealias.h> |
| 29 | +#include <model/cppnamespacealias-odb.hxx> |
28 | 30 | #include <model/cpprelation.h> |
29 | 31 | #include <model/cpprelation-odb.hxx> |
30 | 32 | #include <model/cpprecord.h> |
@@ -117,6 +119,7 @@ class ClangASTVisitor : public clang::RecursiveASTVisitor<ClangASTVisitor> |
117 | 119 | util::persistAll(_typedefs, _ctx.db); |
118 | 120 | util::persistAll(_variables, _ctx.db); |
119 | 121 | util::persistAll(_namespaces, _ctx.db); |
| 122 | + util::persistAll(_namespaceAliases, _ctx.db); |
120 | 123 | util::persistAll(_members, _ctx.db); |
121 | 124 | util::persistAll(_inheritances, _ctx.db); |
122 | 125 | util::persistAll(_friends, _ctx.db); |
@@ -958,6 +961,43 @@ class ClangASTVisitor : public clang::RecursiveASTVisitor<ClangASTVisitor> |
958 | 961 | return true; |
959 | 962 | } |
960 | 963 |
|
| 964 | + bool VisitNamespaceAliasDecl(clang::NamespaceAliasDecl* nad_) |
| 965 | + { |
| 966 | + //--- CppAstNode ---// |
| 967 | + |
| 968 | + model::CppAstNodePtr astNode = std::make_shared<model::CppAstNode>(); |
| 969 | + |
| 970 | + astNode->astValue = getSourceText( |
| 971 | + _clangSrcMgr, |
| 972 | + nad_->getBeginLoc(), |
| 973 | + nad_->getLocation(), |
| 974 | + true); |
| 975 | + |
| 976 | + astNode->location = getFileLoc(nad_->getBeginLoc(), nad_->getEndLoc()); |
| 977 | + astNode->entityHash = util::fnvHash(getUSR(nad_->getAliasedNamespace())); |
| 978 | + astNode->symbolType = model::CppAstNode::SymbolType::NamespaceAlias; |
| 979 | + astNode->astType = model::CppAstNode::AstType::Definition; |
| 980 | + |
| 981 | + astNode->id = model::createIdentifier(*astNode); |
| 982 | + |
| 983 | + if (insertToCache(nad_, astNode)) |
| 984 | + _astNodes.push_back(astNode); |
| 985 | + else |
| 986 | + return true; |
| 987 | + |
| 988 | + //--- CppNamespaceAlias ---// |
| 989 | + |
| 990 | + model::CppNamespaceAliasPtr nsa = std::make_shared<model::CppNamespaceAlias>(); |
| 991 | + _namespaceAliases.push_back(nsa); |
| 992 | + |
| 993 | + nsa->astNodeId = astNode->id; |
| 994 | + nsa->entityHash = astNode->entityHash; |
| 995 | + nsa->name = nad_->getNameAsString(); |
| 996 | + nsa->qualifiedName = nad_->getQualifiedNameAsString(); |
| 997 | + |
| 998 | + return true; |
| 999 | + } |
| 1000 | + |
961 | 1001 | bool VisitCXXConstructExpr(clang::CXXConstructExpr* ce_) |
962 | 1002 | { |
963 | 1003 | model::CppAstNodePtr astNode = std::make_shared<model::CppAstNode>(); |
@@ -1469,18 +1509,19 @@ class ClangASTVisitor : public clang::RecursiveASTVisitor<ClangASTVisitor> |
1469 | 1509 | return false; |
1470 | 1510 | } |
1471 | 1511 |
|
1472 | | - std::vector<model::CppAstNodePtr> _astNodes; |
1473 | | - std::vector<model::CppEnumConstantPtr> _enumConstants; |
1474 | | - std::vector<model::CppEnumPtr> _enums; |
1475 | | - std::vector<model::CppFunctionPtr> _functions; |
| 1512 | + std::vector<model::CppAstNodePtr> _astNodes; |
| 1513 | + std::vector<model::CppEnumConstantPtr> _enumConstants; |
| 1514 | + std::vector<model::CppEnumPtr> _enums; |
| 1515 | + std::vector<model::CppFunctionPtr> _functions; |
1476 | 1516 | std::vector<model::CppRecordPtr> _types; |
1477 | | - std::vector<model::CppTypedefPtr> _typedefs; |
1478 | | - std::vector<model::CppVariablePtr> _variables; |
1479 | | - std::vector<model::CppNamespacePtr> _namespaces; |
1480 | | - std::vector<model::CppMemberTypePtr> _members; |
1481 | | - std::vector<model::CppInheritancePtr> _inheritances; |
1482 | | - std::vector<model::CppFriendshipPtr> _friends; |
1483 | | - std::vector<model::CppRelationPtr> _relations; |
| 1517 | + std::vector<model::CppTypedefPtr> _typedefs; |
| 1518 | + std::vector<model::CppVariablePtr> _variables; |
| 1519 | + std::vector<model::CppNamespacePtr> _namespaces; |
| 1520 | + std::vector<model::CppNamespaceAliasPtr> _namespaceAliases; |
| 1521 | + std::vector<model::CppMemberTypePtr> _members; |
| 1522 | + std::vector<model::CppInheritancePtr> _inheritances; |
| 1523 | + std::vector<model::CppFriendshipPtr> _friends; |
| 1524 | + std::vector<model::CppRelationPtr> _relations; |
1484 | 1525 |
|
1485 | 1526 | // TODO: Maybe we don't even need a stack, if functions can't be nested. |
1486 | 1527 | // Check lambda. |
|
0 commit comments