Skip to content

Commit a69a2db

Browse files
committed
Ast visitor function for using declarations.
Added two enviroment variable definitions to the dev Dockerfile. This way we don't need to add them when compiling a code to test.
1 parent 15d5f73 commit a69a2db

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

docker/dev/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ COPY docker/dev/codecompass-build.sh /usr/local/bin
4545
ENV DATABASE=sqlite \
4646
BUILD_TYPE=Release \
4747
BUILD_DIR=/CodeCompass/build \
48+
LLVM_DIR=/usr/lib/llvm-10/cmake \
49+
Clang_DIR=/usr/lib/cmake/clang-10 \
4850
INSTALL_DIR=/CodeCompass/install \
4951
SOURCE_DIR=/CodeCompass/CodeCompass \
5052
TEST_WORKSPACE=/CodeCompass/test_workspace \

plugins/cpp/parser/src/clangastvisitor.h

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

957957
return true;
958958
}
959+
960+
961+
962+
bool VisitUsingDecl(clang::UsingDecl* ud_){
963+
964+
//--- CppAstNode ---//
965+
966+
model::CppAstNodePtr astNode = std::make_shared<model::CppAstNode>();
967+
968+
//std::string mangledName = getMangledName(_mngCtx, ud_, astNode->location);
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->mangledNameHash = util::fnvHash(mangledName);
977+
astNode->entityHash = util::fnvHash(usr);
978+
astNode->astType = model::CppAstNode::AstType::Definition;
979+
astNode->id = model::createIdentifier(*astNode);
980+
981+
if (insertToCache(ud_, astNode)){
982+
_astNodes.push_back(astNode);
983+
}
984+
985+
return true;
986+
}
987+
959988

960989
bool VisitCXXConstructExpr(clang::CXXConstructExpr* ce_)
961990
{

0 commit comments

Comments
 (0)