logic: reduce access to filesystem while indexing
* use canonical filepath cache in cxx indexer * made constructors of FilePath explicit * use FilePath at more places instead of string * forward declares FilePath wherever possible
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
JavaParser::JavaParser(std::shared_ptr<ParserClient> client, std::shared_ptr<FileRegister> fileRegister)
|
||||
: Parser(client)
|
||||
, m_id(s_nextParserId++)
|
||||
, m_currentFilePath("")
|
||||
{
|
||||
std::shared_ptr<JavaEnvironmentFactory> factory = JavaEnvironmentFactory::getInstance();
|
||||
if (factory)
|
||||
@@ -56,7 +55,7 @@ void JavaParser::buildIndex(std::shared_ptr<IndexerCommandJava> indexerCommand)
|
||||
classPath += path.str() + ";";
|
||||
}
|
||||
|
||||
buildIndex(indexerCommand->getSourceFilePath(), classPath, TextAccess::createFromFile(indexerCommand->getSourceFilePath().str()));
|
||||
buildIndex(indexerCommand->getSourceFilePath(), classPath, TextAccess::createFromFile(indexerCommand->getSourceFilePath()));
|
||||
}
|
||||
|
||||
void JavaParser::buildIndex(const FilePath& filePath, std::shared_ptr<TextAccess> textAccess)
|
||||
@@ -68,7 +67,7 @@ void JavaParser::buildIndex(const FilePath& sourceFilePath, const std::string& c
|
||||
{
|
||||
if (m_javaEnvironment)
|
||||
{
|
||||
m_currentFilePath = sourceFilePath.str();
|
||||
m_currentFilePath = sourceFilePath;
|
||||
|
||||
m_client->onFileParsed(FileSystem::getFileInfoForPath(sourceFilePath));
|
||||
|
||||
@@ -82,7 +81,7 @@ void JavaParser::buildIndex(const FilePath& sourceFilePath, const std::string& c
|
||||
"com/sourcetrail/JavaIndexer",
|
||||
"processFile",
|
||||
m_id,
|
||||
m_currentFilePath,
|
||||
m_currentFilePath.str(),
|
||||
fileContent,
|
||||
classPath,
|
||||
verbose
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "data/indexer/IndexerCommandJava.h"
|
||||
#include "data/parser/Parser.h"
|
||||
#include "data/parser/java/JavaEnvironment.h"
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
struct JNIEnv_;
|
||||
@@ -24,6 +25,7 @@ typedef int jint;
|
||||
class _jstring;
|
||||
typedef _jstring *jstring;
|
||||
|
||||
class FilePath;
|
||||
class FileRegister;
|
||||
|
||||
class JavaParser: public Parser
|
||||
@@ -171,7 +173,7 @@ private:
|
||||
std::shared_ptr<JavaEnvironment> m_javaEnvironment;
|
||||
|
||||
const int m_id;
|
||||
std::string m_currentFilePath;
|
||||
FilePath m_currentFilePath;
|
||||
};
|
||||
|
||||
#endif // JAVA_PARSER_H
|
||||
|
||||
Reference in New Issue
Block a user