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:
@@ -25,11 +25,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stringcachefwd.h>
|
||||
#include <filepathid.h>
|
||||
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
#include <iosfwd>
|
||||
|
||||
using uint = unsigned int;
|
||||
|
||||
@@ -59,18 +58,18 @@ class SourceLocationEntry
|
||||
{
|
||||
public:
|
||||
SourceLocationEntry(SymbolIndex symbolId,
|
||||
FilePathIndex fileId,
|
||||
FilePathId filePathId,
|
||||
LineColumn lineColumn,
|
||||
SymbolType symbolType)
|
||||
: symbolId(symbolId),
|
||||
fileId(fileId),
|
||||
filePathId(filePathId),
|
||||
line(lineColumn.line),
|
||||
column(lineColumn.column),
|
||||
symbolType(symbolType)
|
||||
{}
|
||||
|
||||
SymbolIndex symbolId = 0;
|
||||
FilePathIndex fileId = std::numeric_limits<uint>::max();
|
||||
FilePathId filePathId;
|
||||
uint line = 0;
|
||||
uint column = 0;
|
||||
SymbolType symbolType;
|
||||
@@ -78,7 +77,7 @@ public:
|
||||
friend bool operator==(const SourceLocationEntry &first, const SourceLocationEntry &second)
|
||||
{
|
||||
return first.symbolId == second.symbolId
|
||||
&& first.fileId == second.fileId
|
||||
&& first.filePathId == second.filePathId
|
||||
&& first.line == second.line
|
||||
&& first.column == second.column
|
||||
&& first.symbolType == second.symbolType;
|
||||
@@ -87,6 +86,4 @@ public:
|
||||
|
||||
using SourceLocationEntries = std::vector<SourceLocationEntry>;
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const SourceLocationEntry &entry);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Reference in New Issue
Block a user