src: refactored cxx ast visitor code
* extracted brace recording code into own ast visitor component * removed unnecessary cxx ast visitor code
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
#include "data/parser/Parser.h"
|
||||
|
||||
|
||||
Parser::Parser(std::shared_ptr<ParserClient> client)
|
||||
: m_client(client)
|
||||
{
|
||||
}
|
||||
|
||||
Parser::~Parser()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,17 +2,14 @@
|
||||
#define PARSER_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ParserClient;
|
||||
class TextAccess;
|
||||
|
||||
class Parser
|
||||
{
|
||||
public:
|
||||
Parser(std::shared_ptr<ParserClient> client);
|
||||
virtual ~Parser();
|
||||
virtual ~Parser() = default;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ParserClient> m_client;
|
||||
|
||||
@@ -51,6 +51,8 @@ add_files(
|
||||
data/parser/cxx/CxxAstVisitor.h
|
||||
data/parser/cxx/CxxAstVisitorComponent.cpp
|
||||
data/parser/cxx/CxxAstVisitorComponent.h
|
||||
data/parser/cxx/CxxAstVisitorComponentBraceRecorder.cpp
|
||||
data/parser/cxx/CxxAstVisitorComponentBraceRecorder.h
|
||||
data/parser/cxx/CxxAstVisitorComponentContext.cpp
|
||||
data/parser/cxx/CxxAstVisitorComponentContext.h
|
||||
data/parser/cxx/CxxAstVisitorComponentDeclRefKind.cpp
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "data/parser/cxx/CanonicalFilePathCache.h"
|
||||
#include "data/parser/cxx/CxxAstVisitorComponent.h"
|
||||
#include "data/parser/cxx/CxxAstVisitorComponentBraceRecorder.h"
|
||||
#include "data/parser/cxx/CxxAstVisitorComponentContext.h"
|
||||
#include "data/parser/cxx/CxxAstVisitorComponentDeclRefKind.h"
|
||||
#include "data/parser/cxx/CxxAstVisitorComponentTypeRefKind.h"
|
||||
@@ -67,12 +68,10 @@ CxxAstVisitor::CxxAstVisitor(
|
||||
m_components.push_back(m_declRefKindComponent);
|
||||
m_implicitCodeComponent = std::make_shared<CxxAstVisitorComponentImplicitCode>(this);
|
||||
m_components.push_back(m_implicitCodeComponent);
|
||||
m_indexerComponent = std::make_shared<CxxAstVisitorComponentIndexer>(this, astContext, client, fileRegister);
|
||||
m_indexerComponent = std::make_shared<CxxAstVisitorComponentIndexer>(this, astContext, client);
|
||||
m_components.push_back(m_indexerComponent);
|
||||
}
|
||||
|
||||
CxxAstVisitor::~CxxAstVisitor()
|
||||
{
|
||||
m_braceRecorderComponent = std::make_shared<CxxAstVisitorComponentBraceRecorder>(this, astContext, client);
|
||||
m_components.push_back(m_braceRecorderComponent);
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -790,6 +789,60 @@ ParseLocation CxxAstVisitor::getParseLocation(const clang::SourceRange& sourceRa
|
||||
return parseLocation;
|
||||
}
|
||||
|
||||
bool CxxAstVisitor::shouldVisitStmt(const clang::Stmt* s) const
|
||||
{
|
||||
if (s)
|
||||
{
|
||||
clang::SourceLocation loc = m_astContext->getSourceManager().getExpansionLoc(s->getLocStart());
|
||||
|
||||
if (loc.isInvalid())
|
||||
{
|
||||
loc = s->getLocStart();
|
||||
}
|
||||
|
||||
if (isLocatedInProjectFile(loc))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CxxAstVisitor::shouldVisitDecl(const clang::Decl* decl) const
|
||||
{
|
||||
if (decl)
|
||||
{
|
||||
clang::SourceLocation loc = m_astContext->getSourceManager().getExpansionLoc(decl->getLocation());
|
||||
|
||||
if (loc.isInvalid())
|
||||
{
|
||||
loc = decl->getLocation();
|
||||
}
|
||||
|
||||
if (isLocatedInProjectFile(loc))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CxxAstVisitor::shouldVisitReference(const clang::SourceLocation& referenceLocation, const clang::Decl* contextDecl) const
|
||||
{
|
||||
clang::SourceLocation loc = m_astContext->getSourceManager().getExpansionLoc(referenceLocation);
|
||||
if (loc.isInvalid())
|
||||
{
|
||||
loc = referenceLocation;
|
||||
}
|
||||
|
||||
if (isLocatedInProjectFile(loc))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CxxAstVisitor::isLocatedInProjectFile(clang::SourceLocation loc) const
|
||||
{
|
||||
const clang::SourceManager& sourceManager = m_astContext->getSourceManager();
|
||||
|
||||
@@ -15,6 +15,7 @@ class FileRegister;
|
||||
class FilePath;
|
||||
|
||||
class CxxAstVisitorComponent;
|
||||
class CxxAstVisitorComponentBraceRecorder;
|
||||
class CxxAstVisitorComponentContext;
|
||||
class CxxAstVisitorComponentDeclRefKind;
|
||||
class CxxAstVisitorComponentTypeRefKind;
|
||||
@@ -43,7 +44,7 @@ public:
|
||||
std::shared_ptr<FileRegister> fileRegister,
|
||||
std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache
|
||||
);
|
||||
virtual ~CxxAstVisitor();
|
||||
virtual ~CxxAstVisitor() = default;
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<T> getComponent();
|
||||
@@ -147,6 +148,11 @@ public:
|
||||
ParseLocation getParseLocationOfFunctionBody(const clang::FunctionDecl* decl) const;
|
||||
ParseLocation getParseLocation(const clang::SourceLocation& loc) const;
|
||||
ParseLocation getParseLocation(const clang::SourceRange& sourceRange) const;
|
||||
|
||||
bool shouldVisitStmt(const clang::Stmt* s) const;
|
||||
bool shouldVisitDecl(const clang::Decl* decl) const;
|
||||
bool shouldVisitReference(const clang::SourceLocation& referenceLocation, const clang::Decl* contextDecl) const;
|
||||
|
||||
bool isLocatedInProjectFile(clang::SourceLocation loc) const;
|
||||
|
||||
private:
|
||||
@@ -166,6 +172,7 @@ private:
|
||||
std::shared_ptr<CxxAstVisitorComponentTypeRefKind> m_typeRefKindComponent;
|
||||
std::shared_ptr<CxxAstVisitorComponentImplicitCode> m_implicitCodeComponent;
|
||||
std::shared_ptr<CxxAstVisitorComponentIndexer> m_indexerComponent;
|
||||
std::shared_ptr<CxxAstVisitorComponentBraceRecorder> m_braceRecorderComponent;
|
||||
|
||||
std::shared_ptr<DeclNameCache> m_declNameCache;
|
||||
std::shared_ptr<TypeNameCache> m_typeNameCache;
|
||||
|
||||
@@ -5,10 +5,6 @@ CxxAstVisitorComponent::CxxAstVisitorComponent(CxxAstVisitor* astVisitor)
|
||||
{
|
||||
}
|
||||
|
||||
CxxAstVisitorComponent::~CxxAstVisitorComponent()
|
||||
{
|
||||
}
|
||||
|
||||
CxxAstVisitor* CxxAstVisitorComponent::getAstVisitor()
|
||||
{
|
||||
return m_astVisitor;
|
||||
|
||||
@@ -10,7 +10,7 @@ class CxxAstVisitorComponent
|
||||
{
|
||||
public:
|
||||
CxxAstVisitorComponent(CxxAstVisitor* astVisitor);
|
||||
virtual ~CxxAstVisitorComponent();
|
||||
virtual ~CxxAstVisitorComponent() = default;
|
||||
|
||||
#define DEF_TRAVERSE_CUSTOM_TYPE_PTR(__NAME_TYPE__, __PARAM_TYPE__) \
|
||||
virtual void beginTraverse##__NAME_TYPE__(clang::__PARAM_TYPE__ *v) {} \
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
#include "data/parser/cxx/CxxAstVisitorComponentBraceRecorder.h"
|
||||
|
||||
#include <clang/Lex/Preprocessor.h>
|
||||
|
||||
#include "data/parser/cxx/CxxAstVisitorComponentContext.h"
|
||||
#include "data/parser/cxx/utilityClang.h"
|
||||
#include "data/parser/ParseLocation.h"
|
||||
#include "data/parser/ParserClient.h"
|
||||
|
||||
CxxAstVisitorComponentBraceRecorder::CxxAstVisitorComponentBraceRecorder(
|
||||
CxxAstVisitor* astVisitor, clang::ASTContext* astContext, std::shared_ptr<ParserClient> client
|
||||
)
|
||||
: CxxAstVisitorComponent(astVisitor)
|
||||
, m_astContext(astContext)
|
||||
, m_client(client)
|
||||
{
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentBraceRecorder::visitTagDecl(clang::TagDecl* d)
|
||||
{
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
if (d->isThisDeclarationADefinition() &&
|
||||
(
|
||||
!clang::isa<clang::CXXRecordDecl>(d) ||
|
||||
clang::dyn_cast<clang::CXXRecordDecl>(d)->getTemplateSpecializationKind() != clang::TSK_ImplicitInstantiation
|
||||
))
|
||||
{
|
||||
recordBraces(getParseLocation(d->getBraceRange().getBegin()), getParseLocation(d->getBraceRange().getEnd()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentBraceRecorder::visitNamespaceDecl(clang::NamespaceDecl* d)
|
||||
{
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
recordBraces(
|
||||
getParseLocation(getFirstLBraceLocation(d->getLocStart())),
|
||||
getParseLocation(getLastRBraceLocation(d->getLocStart(), d->getLocEnd()))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentBraceRecorder::visitCompoundStmt(clang::CompoundStmt* s)
|
||||
{
|
||||
if (getAstVisitor()->shouldVisitStmt(s))
|
||||
{
|
||||
const clang::NamedDecl* contextDecl = getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl();
|
||||
if (!contextDecl || !utility::isImplicit(contextDecl))
|
||||
{
|
||||
recordBraces(getParseLocation(s->getLBracLoc()), getParseLocation(s->getRBracLoc()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentBraceRecorder::visitInitListExpr(clang::InitListExpr* s)
|
||||
{
|
||||
if (getAstVisitor()->shouldVisitStmt(s))
|
||||
{
|
||||
if (s->isSyntacticForm())
|
||||
{
|
||||
const clang::NamedDecl* contextDecl = getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl();
|
||||
if (!contextDecl || !utility::isImplicit(contextDecl))
|
||||
{
|
||||
recordBraces(getParseLocation(s->getLBraceLoc()), getParseLocation(s->getRBraceLoc()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentBraceRecorder::visitMSAsmStmt(clang::MSAsmStmt* s)
|
||||
{
|
||||
if (getAstVisitor()->shouldVisitStmt(s))
|
||||
{
|
||||
if (s->hasBraces())
|
||||
{
|
||||
const clang::NamedDecl* contextDecl = getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl();
|
||||
if (!contextDecl || !utility::isImplicit(contextDecl))
|
||||
{
|
||||
recordBraces(
|
||||
getParseLocation(s->getLBraceLoc()),
|
||||
getParseLocation(getLastRBraceLocation(s->getLocStart(), s->getLocEnd()))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ParseLocation CxxAstVisitorComponentBraceRecorder::getParseLocation(const clang::SourceLocation& loc) const
|
||||
{
|
||||
return getAstVisitor()->getParseLocation(loc);
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentBraceRecorder::recordBraces(const ParseLocation& lbraceLoc, const ParseLocation& rbraceLoc)
|
||||
{
|
||||
std::wstring name =
|
||||
lbraceLoc.filePath.fileName() + L"<" +
|
||||
std::to_wstring(lbraceLoc.startLineNumber) + L":" +
|
||||
std::to_wstring(lbraceLoc.startColumnNumber) + L">";
|
||||
|
||||
if (lbraceLoc.startColumnNumber != rbraceLoc.startColumnNumber ||
|
||||
lbraceLoc.endColumnNumber != rbraceLoc.endColumnNumber ||
|
||||
lbraceLoc.startLineNumber != rbraceLoc.startLineNumber ||
|
||||
lbraceLoc.endLineNumber != rbraceLoc.endLineNumber)
|
||||
{
|
||||
if (lbraceLoc.startColumnNumber == lbraceLoc.endColumnNumber &&
|
||||
lbraceLoc.startLineNumber == lbraceLoc.endLineNumber)
|
||||
{
|
||||
m_client->recordLocalSymbol(name, lbraceLoc);
|
||||
}
|
||||
if (rbraceLoc.startColumnNumber == rbraceLoc.endColumnNumber &&
|
||||
rbraceLoc.startLineNumber == rbraceLoc.endLineNumber)
|
||||
{
|
||||
m_client->recordLocalSymbol(name, rbraceLoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clang::SourceLocation CxxAstVisitorComponentBraceRecorder::getFirstLBraceLocation(clang::SourceLocation searchStartLoc) const
|
||||
{
|
||||
const clang::SourceManager& sm = m_astContext->getSourceManager();
|
||||
const clang::LangOptions& opts = m_astContext->getLangOpts();
|
||||
|
||||
{
|
||||
clang::Token token;
|
||||
if (clang::Lexer::getRawToken(searchStartLoc, token, sm, opts))
|
||||
{
|
||||
if (token.getKind() == clang::tok::l_brace)
|
||||
{
|
||||
return token.getLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
llvm::Optional<clang::Token> token = clang::Lexer::findNextToken(searchStartLoc, sm, opts);
|
||||
if (token.hasValue())
|
||||
{
|
||||
if (token.getValue().getKind() == clang::tok::l_brace)
|
||||
{
|
||||
return token.getValue().getLocation();
|
||||
}
|
||||
searchStartLoc = token.getValue().getLocation();
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return clang::SourceLocation();
|
||||
}
|
||||
|
||||
clang::SourceLocation CxxAstVisitorComponentBraceRecorder::getLastRBraceLocation(clang::SourceLocation searchStartLoc, clang::SourceLocation searchEndLoc) const
|
||||
{
|
||||
const clang::SourceManager& sm = m_astContext->getSourceManager();
|
||||
const clang::LangOptions& opts = m_astContext->getLangOpts();
|
||||
|
||||
{
|
||||
searchEndLoc = searchEndLoc.getLocWithOffset(-1);
|
||||
llvm::Optional<clang::Token> token = clang::Lexer::findNextToken(searchEndLoc, sm, opts);
|
||||
if (token.hasValue())
|
||||
{
|
||||
if (token.getValue().getKind() == clang::tok::r_brace)
|
||||
{
|
||||
return token.getValue().getLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
clang::Token token;
|
||||
if (clang::Lexer::getRawToken(searchEndLoc, token, sm, opts))
|
||||
{
|
||||
if (token.getKind() == clang::tok::r_brace)
|
||||
{
|
||||
return token.getLocation();
|
||||
}
|
||||
}
|
||||
if (searchEndLoc < searchStartLoc)
|
||||
{
|
||||
break;
|
||||
}
|
||||
searchEndLoc = searchEndLoc.getLocWithOffset(-1);
|
||||
}
|
||||
return clang::SourceLocation();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef CXX_AST_VISITOR_COMPONENT_BRACE_RECORDER_H
|
||||
#define CXX_AST_VISITOR_COMPONENT_BRACE_RECORDER_H
|
||||
|
||||
#include "data/parser/cxx/CxxAstVisitorComponent.h"
|
||||
|
||||
// This CxxAstVisitorComponent is responsible for recording all matching braces ["{", "}"] throughout the visited AST.
|
||||
class CxxAstVisitorComponentBraceRecorder: public CxxAstVisitorComponent
|
||||
{
|
||||
public:
|
||||
CxxAstVisitorComponentBraceRecorder(CxxAstVisitor* astVisitor, clang::ASTContext* astContext, std::shared_ptr<ParserClient> client);
|
||||
|
||||
void visitTagDecl(clang::TagDecl* d) override;
|
||||
void visitNamespaceDecl(clang::NamespaceDecl* d) override;
|
||||
void visitCompoundStmt(clang::CompoundStmt* s) override;
|
||||
void visitInitListExpr(clang::InitListExpr* s) override;
|
||||
void visitMSAsmStmt(clang::MSAsmStmt* s) override;
|
||||
|
||||
private:
|
||||
ParseLocation getParseLocation(const clang::SourceLocation& loc) const;
|
||||
void recordBraces(const ParseLocation& lbraceLoc, const ParseLocation& rbraceLoc);
|
||||
clang::SourceLocation getFirstLBraceLocation(clang::SourceLocation searchStartLoc) const;
|
||||
clang::SourceLocation getLastRBraceLocation(clang::SourceLocation searchStartLoc, clang::SourceLocation searchEndLoc) const;
|
||||
|
||||
clang::ASTContext* m_astContext;
|
||||
std::shared_ptr<ParserClient> m_client;
|
||||
};
|
||||
|
||||
#endif // CXX_AST_VISITOR_COMPONENT_BRACE_RECORDER_H
|
||||
@@ -5,10 +5,6 @@ CxxAstVisitorComponentContext::CxxAstVisitorComponentContext(CxxAstVisitor* astV
|
||||
{
|
||||
}
|
||||
|
||||
CxxAstVisitorComponentContext::~CxxAstVisitorComponentContext()
|
||||
{
|
||||
}
|
||||
|
||||
const clang::NamedDecl* CxxAstVisitorComponentContext::getTopmostContextDecl() const
|
||||
{
|
||||
for (std::vector<std::shared_ptr<CxxContext>>::const_reverse_iterator it = m_contextStack.rbegin(); it != m_contextStack.rend(); it ++)
|
||||
|
||||
@@ -11,41 +11,40 @@ class CxxAstVisitorComponentContext: public CxxAstVisitorComponent
|
||||
{
|
||||
public:
|
||||
CxxAstVisitorComponentContext(CxxAstVisitor* astVisitor);
|
||||
virtual ~CxxAstVisitorComponentContext();
|
||||
|
||||
const clang::NamedDecl* getTopmostContextDecl() const;
|
||||
NameHierarchy getContextName(const size_t skip = 0);
|
||||
NameHierarchy getContextName(const NameHierarchy& fallback, const size_t skip = 0);
|
||||
|
||||
virtual void beginTraverseDecl(clang::Decl* d) override;
|
||||
virtual void endTraverseDecl(clang::Decl* d) override;
|
||||
void beginTraverseDecl(clang::Decl* d) override;
|
||||
void endTraverseDecl(clang::Decl* d) override;
|
||||
|
||||
virtual void beginTraverseTypeLoc(const clang::TypeLoc& tl) override;
|
||||
virtual void endTraverseTypeLoc(const clang::TypeLoc& tl) override;
|
||||
void beginTraverseTypeLoc(const clang::TypeLoc& tl) override;
|
||||
void endTraverseTypeLoc(const clang::TypeLoc& tl) override;
|
||||
|
||||
virtual void beginTraverseLambdaExpr(clang::LambdaExpr* s) override;
|
||||
virtual void endTraverseLambdaExpr(clang::LambdaExpr* s) override;
|
||||
void beginTraverseLambdaExpr(clang::LambdaExpr* s) override;
|
||||
void endTraverseLambdaExpr(clang::LambdaExpr* s) override;
|
||||
|
||||
virtual void beginTraverseFunctionDecl(clang::FunctionDecl* d) override;
|
||||
virtual void endTraverseFunctionDecl(clang::FunctionDecl* d) override;
|
||||
void beginTraverseFunctionDecl(clang::FunctionDecl* d) override;
|
||||
void endTraverseFunctionDecl(clang::FunctionDecl* d) override;
|
||||
|
||||
virtual void beginTraverseClassTemplateSpecializationDecl(clang::ClassTemplateSpecializationDecl *d) override;
|
||||
virtual void endTraverseClassTemplateSpecializationDecl(clang::ClassTemplateSpecializationDecl *d) override;
|
||||
void beginTraverseClassTemplateSpecializationDecl(clang::ClassTemplateSpecializationDecl *d) override;
|
||||
void endTraverseClassTemplateSpecializationDecl(clang::ClassTemplateSpecializationDecl *d) override;
|
||||
|
||||
virtual void beginTraverseClassTemplatePartialSpecializationDecl(clang::ClassTemplatePartialSpecializationDecl* d) override;
|
||||
virtual void endTraverseClassTemplatePartialSpecializationDecl(clang::ClassTemplatePartialSpecializationDecl* d) override;
|
||||
void beginTraverseClassTemplatePartialSpecializationDecl(clang::ClassTemplatePartialSpecializationDecl* d) override;
|
||||
void endTraverseClassTemplatePartialSpecializationDecl(clang::ClassTemplatePartialSpecializationDecl* d) override;
|
||||
|
||||
virtual void beginTraverseDeclRefExpr(clang::DeclRefExpr* s) override;
|
||||
virtual void endTraverseDeclRefExpr(clang::DeclRefExpr* s) override;
|
||||
void beginTraverseDeclRefExpr(clang::DeclRefExpr* s) override;
|
||||
void endTraverseDeclRefExpr(clang::DeclRefExpr* s) override;
|
||||
|
||||
virtual void beginTraverseTemplateSpecializationTypeLoc(const clang::TemplateSpecializationTypeLoc& loc) override;
|
||||
virtual void endTraverseTemplateSpecializationTypeLoc(const clang::TemplateSpecializationTypeLoc& loc) override;
|
||||
void beginTraverseTemplateSpecializationTypeLoc(const clang::TemplateSpecializationTypeLoc& loc) override;
|
||||
void endTraverseTemplateSpecializationTypeLoc(const clang::TemplateSpecializationTypeLoc& loc) override;
|
||||
|
||||
virtual void beginTraverseUnresolvedLookupExpr(clang::UnresolvedLookupExpr* e) override;
|
||||
virtual void endTraverseUnresolvedLookupExpr(clang::UnresolvedLookupExpr* e) override;
|
||||
void beginTraverseUnresolvedLookupExpr(clang::UnresolvedLookupExpr* e) override;
|
||||
void endTraverseUnresolvedLookupExpr(clang::UnresolvedLookupExpr* e) override;
|
||||
|
||||
virtual void beginTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc) override;
|
||||
virtual void endTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc) override;
|
||||
void beginTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc) override;
|
||||
void endTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc) override;
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr<CxxContext>> m_contextStack;
|
||||
|
||||
@@ -7,16 +7,11 @@ CxxAstVisitorComponentDeclRefKind::CxxAstVisitorComponentDeclRefKind(CxxAstVisit
|
||||
{
|
||||
}
|
||||
|
||||
CxxAstVisitorComponentDeclRefKind::~CxxAstVisitorComponentDeclRefKind()
|
||||
{
|
||||
}
|
||||
|
||||
ReferenceKind CxxAstVisitorComponentDeclRefKind::getReferenceKind() const
|
||||
{
|
||||
return m_thisRefKind;
|
||||
}
|
||||
|
||||
|
||||
void CxxAstVisitorComponentDeclRefKind::beginTraverseDecl(clang::Decl* d)
|
||||
{
|
||||
saveAll();
|
||||
|
||||
@@ -15,58 +15,57 @@ class CxxAstVisitorComponentDeclRefKind: public CxxAstVisitorComponent
|
||||
{
|
||||
public:
|
||||
CxxAstVisitorComponentDeclRefKind(CxxAstVisitor* astVisitor);
|
||||
virtual ~CxxAstVisitorComponentDeclRefKind();
|
||||
|
||||
ReferenceKind getReferenceKind() const;
|
||||
|
||||
virtual void beginTraverseDecl(clang::Decl* d) override;
|
||||
virtual void endTraverseDecl(clang::Decl* d) override;
|
||||
void beginTraverseDecl(clang::Decl* d) override;
|
||||
void endTraverseDecl(clang::Decl* d) override;
|
||||
|
||||
virtual void beginTraverseStmt(clang::Stmt* s) override;
|
||||
virtual void endTraverseStmt(clang::Stmt* s) override;
|
||||
void beginTraverseStmt(clang::Stmt* s) override;
|
||||
void endTraverseStmt(clang::Stmt* s) override;
|
||||
|
||||
virtual void beginTraverseType(const clang::QualType& t) override;
|
||||
virtual void endTraverseType(const clang::QualType& t) override;
|
||||
void beginTraverseType(const clang::QualType& t) override;
|
||||
void endTraverseType(const clang::QualType& t) override;
|
||||
|
||||
virtual void beginTraverseTypeLoc(const clang::TypeLoc& tl) override;
|
||||
virtual void endTraverseTypeLoc(const clang::TypeLoc& tl) override;
|
||||
void beginTraverseTypeLoc(const clang::TypeLoc& tl) override;
|
||||
void endTraverseTypeLoc(const clang::TypeLoc& tl) override;
|
||||
|
||||
virtual void beginTraverseCallCommonCallee() override;
|
||||
void beginTraverseCallCommonCallee() override;
|
||||
|
||||
virtual void beginTraverseCallCommonArgument() override;
|
||||
void beginTraverseCallCommonArgument() override;
|
||||
|
||||
virtual void beginTraverseBinCommaLhs() override;
|
||||
void beginTraverseBinCommaLhs() override;
|
||||
|
||||
virtual void beginTraverseBinCommaRhs() override;
|
||||
void beginTraverseBinCommaRhs() override;
|
||||
|
||||
virtual void beginTraverseAssignCommonLhs() override;
|
||||
void beginTraverseAssignCommonLhs() override;
|
||||
|
||||
virtual void beginTraverseAssignCommonRhs() override;
|
||||
void beginTraverseAssignCommonRhs() override;
|
||||
|
||||
virtual void beginTraverseConstructorInitializer(clang::CXXCtorInitializer* init) override;
|
||||
void beginTraverseConstructorInitializer(clang::CXXCtorInitializer* init) override;
|
||||
|
||||
virtual void beginTraverseCXXTemporaryObjectExpr(clang::CXXTemporaryObjectExpr* s) override;
|
||||
void beginTraverseCXXTemporaryObjectExpr(clang::CXXTemporaryObjectExpr* s) override;
|
||||
|
||||
virtual void beginTraverseUnresolvedMemberExpr(clang::UnresolvedMemberExpr* s) override;
|
||||
void beginTraverseUnresolvedMemberExpr(clang::UnresolvedMemberExpr* s) override;
|
||||
|
||||
virtual void visitVarDecl(clang::VarDecl* d) override;
|
||||
void visitVarDecl(clang::VarDecl* d) override;
|
||||
|
||||
virtual void visitCastExpr(clang::CastExpr* s) override;
|
||||
void visitCastExpr(clang::CastExpr* s) override;
|
||||
|
||||
virtual void visitUnaryAddrOf(clang::UnaryOperator* s) override;
|
||||
void visitUnaryAddrOf(clang::UnaryOperator* s) override;
|
||||
|
||||
virtual void visitUnaryDeref(clang::UnaryOperator* s) override;
|
||||
void visitUnaryDeref(clang::UnaryOperator* s) override;
|
||||
|
||||
virtual void visitDeclStmt(clang::DeclStmt* s) override;
|
||||
void visitDeclStmt(clang::DeclStmt* s) override;
|
||||
|
||||
virtual void visitReturnStmt(clang::ReturnStmt* s) override;
|
||||
void visitReturnStmt(clang::ReturnStmt* s) override;
|
||||
|
||||
virtual void visitInitListExpr(clang::InitListExpr* s) override;
|
||||
void visitInitListExpr(clang::InitListExpr* s) override;
|
||||
|
||||
virtual void visitMemberExpr(clang::MemberExpr* s) override;
|
||||
void visitMemberExpr(clang::MemberExpr* s) override;
|
||||
|
||||
void visitCXXDependentScopeMemberExpr(clang::CXXDependentScopeMemberExpr* s) override;
|
||||
|
||||
virtual void visitCXXDependentScopeMemberExpr(clang::CXXDependentScopeMemberExpr* s) override;
|
||||
|
||||
private:
|
||||
void saveAll();
|
||||
void restoreAll();
|
||||
|
||||
@@ -5,10 +5,6 @@ CxxAstVisitorComponentImplicitCode::CxxAstVisitorComponentImplicitCode(CxxAstVis
|
||||
{
|
||||
}
|
||||
|
||||
CxxAstVisitorComponentImplicitCode::~CxxAstVisitorComponentImplicitCode()
|
||||
{
|
||||
}
|
||||
|
||||
bool CxxAstVisitorComponentImplicitCode::shouldVisitImplicitCode() const
|
||||
{
|
||||
if (!m_stack.empty())
|
||||
@@ -26,7 +22,6 @@ void CxxAstVisitorComponentImplicitCode::beginTraverseDecl(clang::Decl* d)
|
||||
void CxxAstVisitorComponentImplicitCode::endTraverseDecl(clang::Decl* d)
|
||||
{
|
||||
m_stack.pop_back();
|
||||
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentImplicitCode::beginTraverseCXXForRangeStmt(clang::CXXForRangeStmt* s)
|
||||
|
||||
@@ -8,15 +8,14 @@ class CxxAstVisitorComponentImplicitCode: public CxxAstVisitorComponent
|
||||
{
|
||||
public:
|
||||
CxxAstVisitorComponentImplicitCode(CxxAstVisitor* astVisitor);
|
||||
virtual ~CxxAstVisitorComponentImplicitCode();
|
||||
|
||||
bool shouldVisitImplicitCode() const;
|
||||
|
||||
virtual void beginTraverseDecl(clang::Decl* d) override;
|
||||
virtual void endTraverseDecl(clang::Decl* d) override;
|
||||
void beginTraverseDecl(clang::Decl* d) override;
|
||||
void endTraverseDecl(clang::Decl* d) override;
|
||||
|
||||
virtual void beginTraverseCXXForRangeStmt(clang::CXXForRangeStmt* s) override;
|
||||
virtual void endTraverseCXXForRangeStmt(clang::CXXForRangeStmt* s) override;
|
||||
void beginTraverseCXXForRangeStmt(clang::CXXForRangeStmt* s) override;
|
||||
void endTraverseCXXForRangeStmt(clang::CXXForRangeStmt* s) override;
|
||||
|
||||
private:
|
||||
std::vector<bool> m_stack;
|
||||
|
||||
@@ -14,87 +14,18 @@
|
||||
#include "data/parser/ParserClient.h"
|
||||
#include "utility/file/FileRegister.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
clang::SourceLocation getFirstLBraceLocation(clang::SourceLocation searchStartLoc, const clang::SourceManager& sm, const clang::LangOptions& opts)
|
||||
{
|
||||
{
|
||||
clang::Token token;
|
||||
if (clang::Lexer::getRawToken(searchStartLoc, token, sm, opts))
|
||||
{
|
||||
if (token.getKind() == clang::tok::l_brace)
|
||||
{
|
||||
return token.getLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
llvm::Optional<clang::Token> token = clang::Lexer::findNextToken(searchStartLoc, sm, opts);
|
||||
if (token.hasValue())
|
||||
{
|
||||
if (token.getValue().getKind() == clang::tok::l_brace)
|
||||
{
|
||||
return token.getValue().getLocation();
|
||||
}
|
||||
searchStartLoc = token.getValue().getLocation();
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return clang::SourceLocation();
|
||||
}
|
||||
|
||||
clang::SourceLocation getLastRBraceLocation(clang::SourceLocation searchStartLoc, clang::SourceLocation searchEndLoc, const clang::SourceManager& sm, const clang::LangOptions& opts)
|
||||
{
|
||||
{
|
||||
searchEndLoc = searchEndLoc.getLocWithOffset(-1);
|
||||
llvm::Optional<clang::Token> token = clang::Lexer::findNextToken(searchEndLoc, sm, opts);
|
||||
if (token.hasValue())
|
||||
{
|
||||
if (token.getValue().getKind() == clang::tok::r_brace)
|
||||
{
|
||||
return token.getValue().getLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
clang::Token token;
|
||||
if (clang::Lexer::getRawToken(searchEndLoc, token, sm, opts))
|
||||
{
|
||||
if (token.getKind() == clang::tok::r_brace)
|
||||
{
|
||||
return token.getLocation();
|
||||
}
|
||||
}
|
||||
if (searchEndLoc < searchStartLoc)
|
||||
{
|
||||
break;
|
||||
}
|
||||
searchEndLoc = searchEndLoc.getLocWithOffset(-1);
|
||||
}
|
||||
return clang::SourceLocation();
|
||||
}
|
||||
}
|
||||
|
||||
CxxAstVisitorComponentIndexer::CxxAstVisitorComponentIndexer(
|
||||
CxxAstVisitor* astVisitor, clang::ASTContext* astContext, std::shared_ptr<ParserClient> client, std::shared_ptr<FileRegister> fileRegister
|
||||
CxxAstVisitor* astVisitor, clang::ASTContext* astContext, std::shared_ptr<ParserClient> client
|
||||
)
|
||||
: CxxAstVisitorComponent(astVisitor)
|
||||
, m_astContext(astContext)
|
||||
, m_client(client)
|
||||
, m_fileRegister(fileRegister)
|
||||
{
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentIndexer::beginTraverseNestedNameSpecifierLoc(const clang::NestedNameSpecifierLoc& loc)
|
||||
{
|
||||
if (!shouldVisitReference(loc.getBeginLoc(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
if (!getAstVisitor()->shouldVisitReference(loc.getBeginLoc(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -187,7 +118,7 @@ void CxxAstVisitorComponentIndexer::beginTraverseTemplateArgumentLoc(const clang
|
||||
{
|
||||
if (
|
||||
(loc.getArgument().getKind() == clang::TemplateArgument::Template) &&
|
||||
(shouldVisitReference(loc.getLocation(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
(getAstVisitor()->shouldVisitReference(loc.getLocation(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
){
|
||||
// TODO: maybe move this to VisitTemplateName
|
||||
m_client->recordReference(
|
||||
@@ -222,7 +153,7 @@ void CxxAstVisitorComponentIndexer::beginTraverseLambdaCapture(clang::LambdaExpr
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitTagDecl(clang::TagDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
DefinitionKind definitionKind = DEFINITION_NONE;
|
||||
if (d->isThisDeclarationADefinition())
|
||||
@@ -258,21 +189,12 @@ void CxxAstVisitorComponentIndexer::visitTagDecl(clang::TagDecl* d)
|
||||
symbolKind
|
||||
);
|
||||
}
|
||||
|
||||
if (d->isThisDeclarationADefinition() &&
|
||||
(
|
||||
!clang::isa<clang::CXXRecordDecl>(d) ||
|
||||
clang::dyn_cast<clang::CXXRecordDecl>(d)->getTemplateSpecializationKind() != clang::TSK_ImplicitInstantiation
|
||||
))
|
||||
{
|
||||
recordBraces(getParseLocation(d->getBraceRange().getBegin()), getParseLocation(d->getBraceRange().getEnd()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitClassTemplateSpecializationDecl(clang::ClassTemplateSpecializationDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
clang::NamedDecl* specializedFromDecl = nullptr;
|
||||
|
||||
@@ -298,7 +220,7 @@ void CxxAstVisitorComponentIndexer::visitClassTemplateSpecializationDecl(clang::
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitVarDecl(clang::VarDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
SymbolKind symbolKind = utility::getSymbolKind(d);
|
||||
if (symbolKind == SYMBOL_LOCAL_VARIABLE || symbolKind == SYMBOL_PARAMETER)
|
||||
@@ -335,7 +257,7 @@ void CxxAstVisitorComponentIndexer::visitVarDecl(clang::VarDecl* d)
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitVarTemplateSpecializationDecl(clang::VarTemplateSpecializationDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
clang::NamedDecl* specializedFromDecl = nullptr;
|
||||
|
||||
@@ -361,7 +283,7 @@ void CxxAstVisitorComponentIndexer::visitVarTemplateSpecializationDecl(clang::Va
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitFieldDecl(clang::FieldDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(d),
|
||||
@@ -399,7 +321,7 @@ void CxxAstVisitorComponentIndexer::visitFieldDecl(clang::FieldDecl* d)
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitFunctionDecl(clang::FunctionDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(d),
|
||||
@@ -429,7 +351,7 @@ void CxxAstVisitorComponentIndexer::visitFunctionDecl(clang::FunctionDecl* d)
|
||||
void CxxAstVisitorComponentIndexer::visitCXXMethodDecl(clang::CXXMethodDecl* d)
|
||||
{
|
||||
// Decl has been recorded in VisitFunctionDecl
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
for (clang::CXXMethodDecl::method_iterator it = d->begin_overridden_methods(); // TODO: iterate in traversal and use REFERENCE_OVERRIDE or so..
|
||||
it != d->end_overridden_methods(); it++)
|
||||
@@ -457,7 +379,7 @@ void CxxAstVisitorComponentIndexer::visitCXXMethodDecl(clang::CXXMethodDecl* d)
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitEnumConstantDecl(clang::EnumConstantDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(d),
|
||||
@@ -471,7 +393,7 @@ void CxxAstVisitorComponentIndexer::visitEnumConstantDecl(clang::EnumConstantDec
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitNamespaceDecl(clang::NamespaceDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(d),
|
||||
@@ -481,17 +403,12 @@ void CxxAstVisitorComponentIndexer::visitNamespaceDecl(clang::NamespaceDecl* d)
|
||||
utility::convertAccessSpecifier(d->getAccess()),
|
||||
utility::isImplicit(d) ? DEFINITION_IMPLICIT : DEFINITION_EXPLICIT
|
||||
);
|
||||
|
||||
recordBraces(
|
||||
getParseLocation(getFirstLBraceLocation(d->getLocStart(), m_astContext->getSourceManager(), m_astContext->getLangOpts())),
|
||||
getParseLocation(getLastRBraceLocation(d->getLocStart(), d->getLocEnd(), m_astContext->getSourceManager(), m_astContext->getLangOpts()))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitNamespaceAliasDecl(clang::NamespaceAliasDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(d),
|
||||
@@ -514,7 +431,7 @@ void CxxAstVisitorComponentIndexer::visitNamespaceAliasDecl(clang::NamespaceAlia
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitTypedefDecl(clang::TypedefDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(d),
|
||||
@@ -528,7 +445,7 @@ void CxxAstVisitorComponentIndexer::visitTypedefDecl(clang::TypedefDecl* d)
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitTypeAliasDecl(clang::TypeAliasDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(d),
|
||||
@@ -542,7 +459,7 @@ void CxxAstVisitorComponentIndexer::visitTypeAliasDecl(clang::TypeAliasDecl* d)
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitUsingDirectiveDecl(clang::UsingDirectiveDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
const NameHierarchy nameHierarchy = getAstVisitor()->getDeclNameCache()->getValue(d->getNominatedNamespaceAsWritten());
|
||||
|
||||
@@ -560,7 +477,7 @@ void CxxAstVisitorComponentIndexer::visitUsingDirectiveDecl(clang::UsingDirectiv
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitUsingDecl(clang::UsingDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d))
|
||||
if (getAstVisitor()->shouldVisitDecl(d))
|
||||
{
|
||||
ParseLocation loc = getParseLocation(d->getLocation());
|
||||
m_client->recordReference(
|
||||
@@ -574,7 +491,7 @@ void CxxAstVisitorComponentIndexer::visitUsingDecl(clang::UsingDecl* d)
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitNonTypeTemplateParmDecl(clang::NonTypeTemplateParmDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d) && !d->getName().empty()) // We don't create symbols for unnamed template parameters.
|
||||
if (getAstVisitor()->shouldVisitDecl(d) && !d->getName().empty()) // We don't create symbols for unnamed template parameters.
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(d),
|
||||
@@ -588,7 +505,7 @@ void CxxAstVisitorComponentIndexer::visitNonTypeTemplateParmDecl(clang::NonTypeT
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitTemplateTypeParmDecl(clang::TemplateTypeParmDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d) && !d->getName().empty()) // We don't create symbols for unnamed template parameters.
|
||||
if (getAstVisitor()->shouldVisitDecl(d) && !d->getName().empty()) // We don't create symbols for unnamed template parameters.
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(d),
|
||||
@@ -602,7 +519,7 @@ void CxxAstVisitorComponentIndexer::visitTemplateTypeParmDecl(clang::TemplateTyp
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitTemplateTemplateParmDecl(clang::TemplateTemplateParmDecl* d)
|
||||
{
|
||||
if (shouldVisitDecl(d) && !d->getName().empty()) // We don't create symbols for unnamed template parameters.
|
||||
if (getAstVisitor()->shouldVisitDecl(d) && !d->getName().empty()) // We don't create symbols for unnamed template parameters.
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(d),
|
||||
@@ -616,7 +533,7 @@ void CxxAstVisitorComponentIndexer::visitTemplateTemplateParmDecl(clang::Templat
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitTypeLoc(clang::TypeLoc tl)
|
||||
{
|
||||
if ((shouldVisitReference(tl.getBeginLoc(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl())) &&
|
||||
if ((getAstVisitor()->shouldVisitReference(tl.getBeginLoc(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl())) &&
|
||||
(!getAstVisitor()->checkIgnoresTypeLoc(tl)))
|
||||
{
|
||||
if (clang::dyn_cast_or_null<clang::BuiltinType>(tl.getTypePtr()))
|
||||
@@ -644,37 +561,10 @@ void CxxAstVisitorComponentIndexer::visitTypeLoc(clang::TypeLoc tl)
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitCompoundStmt(clang::CompoundStmt* s)
|
||||
{
|
||||
if (shouldVisitStmt(s))
|
||||
{
|
||||
const clang::NamedDecl* contextDecl = getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl();
|
||||
if (!contextDecl || !utility::isImplicit(contextDecl))
|
||||
{
|
||||
recordBraces(getParseLocation(s->getLBracLoc()), getParseLocation(s->getRBracLoc()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitInitListExpr(clang::InitListExpr* s)
|
||||
{
|
||||
if (shouldVisitStmt(s))
|
||||
{
|
||||
if (s->isSyntacticForm())
|
||||
{
|
||||
const clang::NamedDecl* contextDecl = getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl();
|
||||
if (!contextDecl || !utility::isImplicit(contextDecl))
|
||||
{
|
||||
recordBraces(getParseLocation(s->getLBraceLoc()), getParseLocation(s->getRBraceLoc()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitDeclRefExpr(clang::DeclRefExpr* s)
|
||||
{
|
||||
clang::ValueDecl* decl = s->getDecl();
|
||||
if (shouldVisitReference(s->getLocation(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
if (getAstVisitor()->shouldVisitReference(s->getLocation(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
{
|
||||
if ((clang::isa<clang::ParmVarDecl>(decl)) ||
|
||||
(clang::isa<clang::VarDecl>(decl) && decl->getParentFunctionOrMethod() != nullptr)
|
||||
@@ -708,7 +598,7 @@ void CxxAstVisitorComponentIndexer::visitDeclRefExpr(clang::DeclRefExpr* s)
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitMemberExpr(clang::MemberExpr* s)
|
||||
{
|
||||
if (shouldVisitReference(s->getMemberLoc(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
if (getAstVisitor()->shouldVisitReference(s->getMemberLoc(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
{
|
||||
const ReferenceKind refKind = consumeDeclRefContextKind();
|
||||
const NameHierarchy referencedName = getAstVisitor()->getDeclNameCache()->getValue(s->getMemberDecl());
|
||||
@@ -744,7 +634,7 @@ void CxxAstVisitorComponentIndexer::visitCXXConstructExpr(clang::CXXConstructExp
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldVisitReference(s->getLocation(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
if (getAstVisitor()->shouldVisitReference(s->getLocation(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
{
|
||||
//if (e->getParenOrBraceRange().isValid()) {
|
||||
// // XXX: This code is a kludge. Recording calls to constructors is
|
||||
@@ -809,7 +699,7 @@ void CxxAstVisitorComponentIndexer::visitCXXConstructExpr(clang::CXXConstructExp
|
||||
void CxxAstVisitorComponentIndexer::visitLambdaExpr(clang::LambdaExpr* s)
|
||||
{
|
||||
clang::CXXMethodDecl* methodDecl = s->getCallOperator();
|
||||
if (shouldVisitDecl(methodDecl))
|
||||
if (getAstVisitor()->shouldVisitDecl(methodDecl))
|
||||
{
|
||||
m_client->recordSymbol(
|
||||
getAstVisitor()->getDeclNameCache()->getValue(methodDecl),
|
||||
@@ -822,28 +712,9 @@ void CxxAstVisitorComponentIndexer::visitLambdaExpr(clang::LambdaExpr* s)
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitMSAsmStmt(clang::MSAsmStmt* s)
|
||||
{
|
||||
if (shouldVisitStmt(s))
|
||||
{
|
||||
if (s->hasBraces())
|
||||
{
|
||||
const clang::NamedDecl* contextDecl = getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl();
|
||||
if (!contextDecl || !utility::isImplicit(contextDecl))
|
||||
{
|
||||
ParseLocation asdasd = getParseLocation(s->getLocEnd());
|
||||
recordBraces(
|
||||
getParseLocation(s->getLBraceLoc()),
|
||||
getParseLocation(getLastRBraceLocation(s->getLocStart(), s->getLocEnd(), m_astContext->getSourceManager(), m_astContext->getLangOpts()))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentIndexer::visitConstructorInitializer(clang::CXXCtorInitializer* init)
|
||||
{
|
||||
if (shouldVisitReference(init->getMemberLocation(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
if (getAstVisitor()->shouldVisitReference(init->getMemberLocation(), getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getTopmostContextDecl()))
|
||||
{
|
||||
// record the field usage here because it is not a DeclRefExpr
|
||||
if (clang::FieldDecl* memberDecl = init->getMember())
|
||||
@@ -877,33 +748,6 @@ void CxxAstVisitorComponentIndexer::recordTemplateMemberSpecialization(
|
||||
}
|
||||
}
|
||||
|
||||
void CxxAstVisitorComponentIndexer::recordBraces(const ParseLocation& lbraceLoc, const ParseLocation& rbraceLoc)
|
||||
{
|
||||
std::wstring name =
|
||||
lbraceLoc.filePath.fileName() + L"<" +
|
||||
std::to_wstring(lbraceLoc.startLineNumber) + L":" +
|
||||
std::to_wstring(lbraceLoc.startColumnNumber) + L">";
|
||||
|
||||
if (lbraceLoc.startColumnNumber != rbraceLoc.startColumnNumber ||
|
||||
lbraceLoc.endColumnNumber != rbraceLoc.endColumnNumber ||
|
||||
lbraceLoc.startLineNumber != rbraceLoc.startLineNumber ||
|
||||
lbraceLoc.endLineNumber != rbraceLoc.endLineNumber)
|
||||
{
|
||||
if (lbraceLoc.startColumnNumber == lbraceLoc.endColumnNumber &&
|
||||
lbraceLoc.startLineNumber == lbraceLoc.endLineNumber)
|
||||
{
|
||||
m_client->recordLocalSymbol(name, lbraceLoc);
|
||||
//m_client->recordLocalSymbol(L"BRACE_START", lbraceLoc);
|
||||
}
|
||||
if (rbraceLoc.startColumnNumber == rbraceLoc.endColumnNumber &&
|
||||
rbraceLoc.startLineNumber == rbraceLoc.endLineNumber)
|
||||
{
|
||||
m_client->recordLocalSymbol(name, rbraceLoc);
|
||||
//m_client->recordLocalSymbol(L"BRACE_END", rbraceLoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ParseLocation CxxAstVisitorComponentIndexer::getParseLocationOfTagDeclBody(clang::TagDecl* decl) const
|
||||
{
|
||||
return getAstVisitor()->getParseLocationOfTagDeclBody(decl);
|
||||
@@ -940,57 +784,3 @@ ReferenceKind CxxAstVisitorComponentIndexer::consumeDeclRefContextKind()
|
||||
}
|
||||
return refKind;
|
||||
}
|
||||
|
||||
bool CxxAstVisitorComponentIndexer::shouldVisitStmt(const clang::Stmt* s) const
|
||||
{
|
||||
if (s)
|
||||
{
|
||||
clang::SourceLocation loc = m_astContext->getSourceManager().getExpansionLoc(s->getLocStart());
|
||||
|
||||
if (loc.isInvalid())
|
||||
{
|
||||
loc = s->getLocStart();
|
||||
}
|
||||
|
||||
if (getAstVisitor()->isLocatedInProjectFile(loc))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CxxAstVisitorComponentIndexer::shouldVisitDecl(const clang::Decl* decl) const
|
||||
{
|
||||
if (decl)
|
||||
{
|
||||
clang::SourceLocation loc = m_astContext->getSourceManager().getExpansionLoc(decl->getLocation());
|
||||
|
||||
if (loc.isInvalid())
|
||||
{
|
||||
loc = decl->getLocation();
|
||||
}
|
||||
|
||||
if (getAstVisitor()->isLocatedInProjectFile(loc))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CxxAstVisitorComponentIndexer::shouldVisitReference(const clang::SourceLocation& referenceLocation, const clang::Decl* contextDecl) const
|
||||
{
|
||||
clang::SourceLocation loc = m_astContext->getSourceManager().getExpansionLoc(referenceLocation);
|
||||
if (loc.isInvalid())
|
||||
{
|
||||
loc = referenceLocation;
|
||||
}
|
||||
|
||||
if (getAstVisitor()->isLocatedInProjectFile(loc))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "data/parser/cxx/CxxAstVisitor.h"
|
||||
#include "data/parser/cxx/CxxAstVisitorComponent.h"
|
||||
#include "data/parser/ReferenceKind.h"
|
||||
#include "data/parser/SymbolKind.h"
|
||||
@@ -12,7 +11,7 @@
|
||||
class CxxAstVisitorComponentIndexer: public CxxAstVisitorComponent
|
||||
{
|
||||
public:
|
||||
CxxAstVisitorComponentIndexer(CxxAstVisitor* astVisitor, clang::ASTContext* astContext, std::shared_ptr<ParserClient> client, std::shared_ptr<FileRegister> fileRegister);
|
||||
CxxAstVisitorComponentIndexer(CxxAstVisitor* astVisitor, clang::ASTContext* astContext, std::shared_ptr<ParserClient> client);
|
||||
|
||||
void beginTraverseNestedNameSpecifierLoc(const clang::NestedNameSpecifierLoc& loc) override;
|
||||
void beginTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc) override;
|
||||
@@ -38,13 +37,10 @@ public:
|
||||
|
||||
void visitTypeLoc(clang::TypeLoc tl) override;
|
||||
|
||||
void visitCompoundStmt(clang::CompoundStmt* s) override;
|
||||
void visitInitListExpr(clang::InitListExpr* s) override;
|
||||
void visitDeclRefExpr(clang::DeclRefExpr* s) override;
|
||||
void visitMemberExpr(clang::MemberExpr* s) override;
|
||||
void visitCXXConstructExpr(clang::CXXConstructExpr* s) override;
|
||||
void visitLambdaExpr(clang::LambdaExpr* s) override;
|
||||
void visitMSAsmStmt(clang::MSAsmStmt* s) override;
|
||||
|
||||
void visitConstructorInitializer(clang::CXXCtorInitializer* init) override;
|
||||
|
||||
@@ -56,8 +52,6 @@ private:
|
||||
SymbolKind symbolKind
|
||||
);
|
||||
|
||||
void recordBraces(const ParseLocation& lbraceLoc, const ParseLocation& rbraceLoc);
|
||||
|
||||
ParseLocation getParseLocationOfTagDeclBody(clang::TagDecl* decl) const;
|
||||
ParseLocation getParseLocationOfFunctionBody(const clang::FunctionDecl* decl) const;
|
||||
ParseLocation getParseLocation(const clang::SourceLocation& loc) const;
|
||||
@@ -65,13 +59,8 @@ private:
|
||||
|
||||
ReferenceKind consumeDeclRefContextKind();
|
||||
|
||||
bool shouldVisitStmt(const clang::Stmt* s) const;
|
||||
bool shouldVisitDecl(const clang::Decl* decl) const;
|
||||
bool shouldVisitReference(const clang::SourceLocation& referenceLocation, const clang::Decl* contextDecl) const;
|
||||
|
||||
clang::ASTContext* m_astContext;
|
||||
std::shared_ptr<ParserClient> m_client;
|
||||
std::shared_ptr<FileRegister> m_fileRegister;
|
||||
};
|
||||
|
||||
#endif // CXX_AST_VISITOR_COMPONENT_INDEXER_H
|
||||
|
||||
@@ -5,10 +5,6 @@ CxxAstVisitorComponentTypeRefKind::CxxAstVisitorComponentTypeRefKind(CxxAstVisit
|
||||
{
|
||||
}
|
||||
|
||||
CxxAstVisitorComponentTypeRefKind::~CxxAstVisitorComponentTypeRefKind()
|
||||
{
|
||||
}
|
||||
|
||||
ReferenceKind CxxAstVisitorComponentTypeRefKind::getReferenceKind() const
|
||||
{
|
||||
for (auto it = m_refKindStack.rbegin(); it != m_refKindStack.rend(); it++)
|
||||
|
||||
@@ -15,18 +15,17 @@ class CxxAstVisitorComponentTypeRefKind: public CxxAstVisitorComponent
|
||||
{
|
||||
public:
|
||||
CxxAstVisitorComponentTypeRefKind(CxxAstVisitor* astVisitor);
|
||||
virtual ~CxxAstVisitorComponentTypeRefKind();
|
||||
|
||||
ReferenceKind getReferenceKind() const;
|
||||
|
||||
virtual void beginTraverseCXXBaseSpecifier() override;
|
||||
virtual void endTraverseCXXBaseSpecifier() override;
|
||||
void beginTraverseCXXBaseSpecifier() override;
|
||||
void endTraverseCXXBaseSpecifier() override;
|
||||
|
||||
virtual void beginTraverseTemplateDefaultArgumentLoc() override;
|
||||
virtual void endTraverseTemplateDefaultArgumentLoc() override;
|
||||
void beginTraverseTemplateDefaultArgumentLoc() override;
|
||||
void endTraverseTemplateDefaultArgumentLoc() override;
|
||||
|
||||
virtual void beginTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc) override;
|
||||
virtual void endTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc) override;
|
||||
void beginTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc) override;
|
||||
void endTraverseTemplateArgumentLoc(const clang::TemplateArgumentLoc& loc) override;
|
||||
|
||||
private:
|
||||
std::vector<ReferenceKind> m_refKindStack;
|
||||
|
||||
@@ -9,9 +9,9 @@ class CxxCompilationDatabaseSingle
|
||||
public:
|
||||
CxxCompilationDatabaseSingle(const clang::tooling::CompileCommand& command);
|
||||
|
||||
virtual std::vector<clang::tooling::CompileCommand> getCompileCommands(llvm::StringRef FilePath) const override;
|
||||
virtual std::vector<std::string> getAllFiles() const override;
|
||||
virtual std::vector<clang::tooling::CompileCommand> getAllCompileCommands() const override;
|
||||
std::vector<clang::tooling::CompileCommand> getCompileCommands(llvm::StringRef FilePath) const override;
|
||||
std::vector<std::string> getAllFiles() const override;
|
||||
std::vector<clang::tooling::CompileCommand> getAllCompileCommands() const override;
|
||||
|
||||
private:
|
||||
clang::tooling::CompileCommand m_command;
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
#include "data/parser/cxx/CxxContext.h"
|
||||
|
||||
CxxContext::~CxxContext()
|
||||
{
|
||||
}
|
||||
|
||||
CxxContextDecl::CxxContextDecl(const clang::NamedDecl* decl, std::shared_ptr<DeclNameCache> nameCache)
|
||||
: m_decl(decl)
|
||||
, m_nameCache(nameCache)
|
||||
{
|
||||
}
|
||||
|
||||
CxxContextDecl::~CxxContextDecl()
|
||||
{
|
||||
}
|
||||
|
||||
NameHierarchy CxxContextDecl::getName()
|
||||
{
|
||||
return m_nameCache->getValue(m_decl);
|
||||
@@ -30,10 +22,6 @@ CxxContextType::CxxContextType(const clang::Type* type, std::shared_ptr<TypeName
|
||||
{
|
||||
}
|
||||
|
||||
CxxContextType::~CxxContextType()
|
||||
{
|
||||
}
|
||||
|
||||
NameHierarchy CxxContextType::getName()
|
||||
{
|
||||
return m_nameCache->getValue(m_type);
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef UnorderedCache<const clang::Type*, NameHierarchy> TypeNameCache;
|
||||
class CxxContext
|
||||
{
|
||||
public:
|
||||
virtual ~CxxContext();
|
||||
virtual ~CxxContext() = default;
|
||||
virtual NameHierarchy getName() = 0;
|
||||
virtual const clang::NamedDecl* getDecl() = 0;
|
||||
};
|
||||
@@ -21,9 +21,8 @@ class CxxContextDecl: public CxxContext
|
||||
{
|
||||
public:
|
||||
CxxContextDecl(const clang::NamedDecl* decl, std::shared_ptr<DeclNameCache> nameCache);
|
||||
virtual ~CxxContextDecl();
|
||||
virtual NameHierarchy getName();
|
||||
virtual const clang::NamedDecl* getDecl();
|
||||
NameHierarchy getName() override;
|
||||
const clang::NamedDecl* getDecl() override;
|
||||
|
||||
private:
|
||||
const clang::NamedDecl* m_decl;
|
||||
@@ -34,9 +33,8 @@ class CxxContextType: public CxxContext
|
||||
{
|
||||
public:
|
||||
CxxContextType(const clang::Type* type, std::shared_ptr<TypeNameCache> nameCache);
|
||||
virtual ~CxxContextType();
|
||||
virtual NameHierarchy getName();
|
||||
virtual const clang::NamedDecl* getDecl();
|
||||
NameHierarchy getName() override;
|
||||
const clang::NamedDecl* getDecl() override;
|
||||
|
||||
private:
|
||||
const clang::Type* m_type;
|
||||
|
||||
@@ -22,10 +22,10 @@ public:
|
||||
bool useLogging = true
|
||||
);
|
||||
|
||||
void BeginSourceFile(const clang::LangOptions& langOptions, const clang::Preprocessor* preProcessor);
|
||||
void EndSourceFile();
|
||||
void BeginSourceFile(const clang::LangOptions& langOptions, const clang::Preprocessor* preProcessor) override;
|
||||
void EndSourceFile() override;
|
||||
|
||||
void HandleDiagnostic(clang::DiagnosticsEngine::Level level, const clang::Diagnostic& info);
|
||||
void HandleDiagnostic(clang::DiagnosticsEngine::Level level, const clang::Diagnostic& info) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ParserClient> m_client;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "data/parser/cxx/CanonicalFilePathCache.h"
|
||||
#include "data/parser/cxx/CxxCompilationDatabaseSingle.h"
|
||||
#include "data/parser/cxx/CxxDiagnosticConsumer.h"
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/file/FileRegister.h"
|
||||
#include "utility/logging/logging.h"
|
||||
@@ -66,10 +65,6 @@ CxxParser::CxxParser(std::shared_ptr<ParserClient> client, std::shared_ptr<FileR
|
||||
llvm::InitializeNativeTargetAsmParser();
|
||||
}
|
||||
|
||||
CxxParser::~CxxParser()
|
||||
{
|
||||
}
|
||||
|
||||
void CxxParser::buildIndex(std::shared_ptr<IndexerCommandCxxCdb> indexerCommand)
|
||||
{
|
||||
clang::tooling::CompileCommand compileCommand;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef CXX_PARSER_H
|
||||
#define CXX_PARSER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "data/parser/Parser.h"
|
||||
|
||||
class CanonicalFilePathCache;
|
||||
@@ -10,6 +13,7 @@ class FileRegister;
|
||||
class IndexerCommandCxxCdb;
|
||||
class IndexerCommandCxxEmpty;
|
||||
class TaskParseCxx;
|
||||
class TextAccess;
|
||||
|
||||
namespace clang {
|
||||
namespace tooling {
|
||||
@@ -22,7 +26,6 @@ class CxxParser: public Parser
|
||||
{
|
||||
public:
|
||||
CxxParser(std::shared_ptr<ParserClient> client, std::shared_ptr<FileRegister> fileRegister);
|
||||
~CxxParser();
|
||||
|
||||
void buildIndex(std::shared_ptr<IndexerCommandCxxCdb> indexerCommand);
|
||||
void buildIndex(std::shared_ptr<IndexerCommandCxxEmpty> indexerCommand);
|
||||
|
||||
@@ -27,28 +27,28 @@ public:
|
||||
std::shared_ptr<FileRegister> fileRegister,
|
||||
std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache);
|
||||
|
||||
virtual void FileChanged(
|
||||
void FileChanged(
|
||||
clang::SourceLocation location, FileChangeReason reason, clang::SrcMgr::CharacteristicKind, clang::FileID) override;
|
||||
|
||||
virtual void InclusionDirective(
|
||||
void InclusionDirective(
|
||||
clang::SourceLocation hashLocation, const clang::Token& includeToken, llvm::StringRef fileName, bool isAngled,
|
||||
clang::CharSourceRange fileNameRange, const clang::FileEntry* fileEntry, llvm::StringRef searchPath,
|
||||
llvm::StringRef relativePath, const clang::Module* imported) override;
|
||||
|
||||
virtual void MacroDefined(const clang::Token& macroNameToken, const clang::MacroDirective* macroDirective) override;
|
||||
virtual void MacroUndefined(
|
||||
const clang::Token& macroNameToken,
|
||||
const clang::MacroDefinition& macroDefinition,
|
||||
void MacroDefined(const clang::Token& macroNameToken, const clang::MacroDirective* macroDirective) override;
|
||||
void MacroUndefined(
|
||||
const clang::Token& macroNameToken,
|
||||
const clang::MacroDefinition& macroDefinition,
|
||||
const clang::MacroDirective* macroUndefinition) override;
|
||||
|
||||
virtual void Defined(
|
||||
void Defined(
|
||||
const clang::Token& macroNameToken, const clang::MacroDefinition& macroDefinition, clang::SourceRange range) override;
|
||||
virtual void Ifdef(clang::SourceLocation location, const clang::Token& macroNameToken,
|
||||
void Ifdef(clang::SourceLocation location, const clang::Token& macroNameToken,
|
||||
const clang::MacroDefinition& macroDefinition) override;
|
||||
virtual void Ifndef(clang::SourceLocation location, const clang::Token& macroNameToken,
|
||||
void Ifndef(clang::SourceLocation location, const clang::Token& macroNameToken,
|
||||
const clang::MacroDefinition& macroDefinition) override;
|
||||
|
||||
virtual void MacroExpands(
|
||||
void MacroExpands(
|
||||
const clang::Token& macroNameToken, const clang::MacroDefinition& macroDirective,
|
||||
clang::SourceRange range, const clang::MacroArgs* args
|
||||
) override;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include "data/indexer/IndexerCommandJava.h"
|
||||
#include "data/parser/Parser.h"
|
||||
@@ -27,6 +28,7 @@ class _jstring;
|
||||
typedef _jstring *jstring;
|
||||
|
||||
class FilePath;
|
||||
class TextAccess;
|
||||
|
||||
class JavaParser: public Parser
|
||||
{
|
||||
@@ -41,7 +43,7 @@ public:
|
||||
|
||||
private:
|
||||
void buildIndex(
|
||||
const FilePath& sourceFilePath,
|
||||
const FilePath& sourceFilePath,
|
||||
const std::string& languageStandard,
|
||||
const std::string& classPath,
|
||||
std::shared_ptr<TextAccess> textAccess);
|
||||
@@ -130,7 +132,7 @@ private:
|
||||
LOG_ERROR("parser with id " + std::to_string(parserId) + " not found"); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
DEF_RELAYING_METHOD_1(LogInfo, jstring)
|
||||
DEF_RELAYING_METHOD_1(LogWarning, jstring)
|
||||
DEF_RELAYING_METHOD_1(LogError, jstring)
|
||||
|
||||
Reference in New Issue
Block a user