src: minior code cleanup

This commit is contained in:
mlangkabel
2019-11-11 14:32:10 +01:00
parent ceb30020b5
commit 4cf852770e
10 changed files with 4 additions and 144 deletions
@@ -24,10 +24,6 @@ ASTConsumer::ASTConsumer(
}
}
ASTConsumer::~ASTConsumer()
{
}
void ASTConsumer::HandleTranslationUnit(clang::ASTContext& context)
{
m_visitor->indexDecl(context.getTranslationUnitDecl());
+1 -1
View File
@@ -21,7 +21,7 @@ public:
std::shared_ptr<IndexerStateInfo> indexerStateInfo
);
virtual ~ASTConsumer();
virtual ~ASTConsumer() = default;
virtual void HandleTranslationUnit(clang::ASTContext& context) override;
@@ -14,10 +14,6 @@ CommentHandler::CommentHandler(
{
}
CommentHandler::~CommentHandler()
{
}
bool CommentHandler::HandleComment(clang::Preprocessor& preprocessor, clang::SourceRange sourceRange)
{
const clang::SourceManager& sourceManager = preprocessor.getSourceManager();
+1 -1
View File
@@ -15,7 +15,7 @@ public:
std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache
);
virtual ~CommentHandler();
virtual ~CommentHandler() = default;
virtual bool HandleComment(clang::Preprocessor& preprocessor, clang::SourceRange sourceRange) override;
@@ -25,7 +25,7 @@ void CxxAstVisitorComponentBraceRecorder::visitTagDecl(clang::TagDecl* d)
(
!clang::isa<clang::CXXRecordDecl>(d) ||
clang::dyn_cast<clang::CXXRecordDecl>(d)->getTemplateSpecializationKind() != clang::TSK_ImplicitInstantiation
))
))
{
recordBraces(
getFilePath(d->getBraceRange().getBegin()),
@@ -75,21 +75,9 @@ void CxxAstVisitorComponentContext::endTraverseDecl(clang::Decl* d)
{
m_contextStack.pop_back();
}
#include "CxxTypeNameResolver.h"
void CxxAstVisitorComponentContext::beginTraverseTypeLoc(const clang::TypeLoc& tl)
{
std::wstring namesss;
std::unique_ptr<CxxTypeName> typeName =
CxxTypeNameResolver(getAstVisitor()->getCanonicalFilePathCache()).getName(tl.getTypePtr());
if (typeName)
{
namesss = typeName->toNameHierarchy().getQualifiedNameWithSignature();
}
std::shared_ptr<CxxContextType> context;
clang::TypeLoc::TypeLocClass tlcc = tl.getTypeLocClass();
if (!getAstVisitor()->checkIgnoresTypeLoc(tl))
@@ -170,14 +158,6 @@ void CxxAstVisitorComponentContext::endTraverseDeclRefExpr(clang::DeclRefExpr* s
void CxxAstVisitorComponentContext::beginTraverseTemplateSpecializationTypeLoc(const clang::TemplateSpecializationTypeLoc& loc)
{
std::wstring namesss;
std::unique_ptr<CxxTypeName> typeName =
CxxTypeNameResolver(getAstVisitor()->getCanonicalFilePathCache()).getName(loc.getTypePtr());
if (typeName)
{
namesss = typeName->toNameHierarchy().getQualifiedNameWithSignature();
}
bool recordContext = true;
const clang::TemplateSpecializationType* tst = loc.getTypePtr();
if (tst && tst->getTemplateName().isDependent())
@@ -692,29 +692,6 @@ void CxxAstVisitorComponentIndexer::visitCXXConstructExpr(clang::CXXConstructExp
if (getAstVisitor()->shouldVisitReference(s->getLocation()))
{
//if (e->getParenOrBraceRange().isValid()) {
// // XXX: This code is a kludge. Recording calls to constructors is
// // troublesome because there isn't an obvious location to associate the
// // call with. Consider:
// // A::A() : field(1, 2, 3) {}
// // new A<B>(1, 2, 3)
// // struct A { A(B); }; A f() { B b; return b; }
// // Implicit calls to conversion operator methods pose a similar
// // problem.
// //
// // Recording constructor calls is very useful, though, so, as a
// // temporary measure, when there are constructor arguments surrounded
// // by parentheses, associate the call with the right parenthesis.
// //
// // Perhaps the right fix is to associate the call with the line itself
// // or with a larger span which may have other references nested within
// // it. The fix may have implications for the navigator GUI.
// RecordDeclRefExpr(
// e->getConstructor(),
// e->getParenOrBraceRange().getEnd(),
// e,
// CF_Called);
//}
clang::SourceLocation loc;
clang::SourceLocation braceBeginLoc = s->getParenOrBraceRange().getBegin();
clang::SourceLocation nameBeginLoc = s->getSourceRange().getBegin();
@@ -188,7 +188,6 @@ ParseLocation utility::getParseLocation(
return ParseLocation();
}
ParseLocation utility::getParseLocation(
const clang::SourceRange& sourceRange,
const clang::SourceManager& sourceManager,
@@ -1,52 +0,0 @@
#include "IndexerCommandJava.h"
#include "utilityString.h"
IndexerCommandType IndexerCommandJava::getStaticIndexerCommandType()
{
return INDEXER_COMMAND_JAVA;
}
IndexerCommandJava::IndexerCommandJava(
const FilePath& sourceFilePath,
const std::set<FilePath>& indexedPaths,
const std::set<FilePathFilter>& excludeFilters,
const std::string& languageStandard,
const std::vector<FilePath>& classPath
)
: IndexerCommand(sourceFilePath, indexedPaths, excludeFilters)
, m_languageStandard(languageStandard)
, m_classPath(classPath)
{
}
IndexerCommandJava::~IndexerCommandJava()
{
}
IndexerCommandType IndexerCommandJava::getIndexerCommandType() const
{
return getStaticIndexerCommandType();
}
size_t IndexerCommandJava::getByteSize(size_t stringSize) const
{
size_t size = IndexerCommand::getByteSize(stringSize);
for (auto& i : m_classPath)
{
size += stringSize + utility::encodeToUtf8(i.wstr()).size();
}
return size;
}
std::string IndexerCommandJava::getLanguageStandard() const
{
return m_languageStandard;
}
std::vector<FilePath> IndexerCommandJava::getClassPath() const
{
return m_classPath;
}
@@ -1,36 +0,0 @@
#ifndef INDEXER_COMMAND_JAVA_H
#define INDEXER_COMMAND_JAVA_H
#include <vector>
#include "IndexerCommand.h"
class FilePath;
class IndexerCommandJava
: public IndexerCommand
{
public:
static IndexerCommandType getStaticIndexerCommandType();
IndexerCommandJava(
const FilePath& sourceFilePath,
const std::set<FilePath>& indexedPaths,
const std::set<FilePathFilter>& excludeFilters,
const std::string& languageStandard,
const std::vector<FilePath>& classPath);
virtual ~IndexerCommandJava();
virtual IndexerCommandType getIndexerCommandType() const override;
virtual size_t getByteSize(size_t stringSize) const override;
std::string getLanguageStandard() const;
std::vector<FilePath> getClassPath() const;
private:
const std::string m_languageStandard;
std::vector<FilePath> m_classPath;
};
#endif // INDEXER_COMMAND_JAVA_H