forked from qt-creator/qt-creator
Clang: Add file cache
The database is using file path integer ids to handle file paths because otherwise we would save many redundant data. This patch is improving it further with the introduction of a database based file path cache. The entries are now divided in a directory path and file name. This is quite handy for directory based file watching. Change-Id: I03f2e388e43f3d521d6bf8e39dfb95eb2309dc73 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -27,39 +27,26 @@
|
||||
|
||||
#include <utils/smallstring.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <filepathid.h>
|
||||
|
||||
#include <vector>
|
||||
#include <tuple>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace ClangRefactoring {
|
||||
|
||||
class SourceLocations
|
||||
struct SourceLocation
|
||||
{
|
||||
public:
|
||||
struct Location
|
||||
{
|
||||
Location(qint64 sourceId, qint64 line, qint64 column)
|
||||
: sourceId(sourceId), line(line), column(column)
|
||||
{}
|
||||
SourceLocation(ClangBackEnd::FilePathId filePathId, int line, int column)
|
||||
: filePathId(filePathId), line(line), column(column)
|
||||
{}
|
||||
SourceLocation(int directoryId, int sourceId, int line, int column)
|
||||
: filePathId{directoryId, sourceId}, line(line), column(column)
|
||||
{}
|
||||
|
||||
qint64 sourceId;
|
||||
qint64 line;
|
||||
qint64 column;
|
||||
};
|
||||
|
||||
struct Source
|
||||
{
|
||||
Source(qint64 sourceId, Utils::PathString &&sourcePath)
|
||||
: sourceId(sourceId), sourcePath(std::move(sourcePath))
|
||||
{}
|
||||
|
||||
qint64 sourceId;
|
||||
Utils::PathString sourcePath;
|
||||
};
|
||||
|
||||
std::vector<Location> locations;
|
||||
std::unordered_map<qint64, Utils::PathString> sources;
|
||||
ClangBackEnd::FilePathId filePathId;
|
||||
int line;
|
||||
int column;
|
||||
};
|
||||
|
||||
using SourceLocations = std::vector<SourceLocation>;
|
||||
|
||||
} // namespace ClangRefactoring
|
||||
|
||||
Reference in New Issue
Block a user