data: Refactored ParserClient API to return and use Ids instead of NameHierarchies for faster indexing
* Pass NameHierarchy to record new symbol returning an Id * Cache symbol Ids in Parser implementation * Reuse symbol Ids as reference when recording related data * Pass FilePath to record new file returning an Id * Cache file Ids in CanonicalFilePathCache * Store file Id in ParseLocation instead of FilePath fortune cookie message = You know a silent way to impose your will.
This commit is contained in:
@@ -2,78 +2,36 @@
|
||||
#define PARSER_CLIENT_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "NameHierarchy.h"
|
||||
#include "AccessKind.h"
|
||||
#include "DefinitionKind.h"
|
||||
#include "NameHierarchy.h"
|
||||
#include "ParseLocation.h"
|
||||
#include "ReferenceKind.h"
|
||||
#include "SymbolKind.h"
|
||||
#include "DefinitionKind.h"
|
||||
#include "FileInfo.h"
|
||||
#include "types.h"
|
||||
|
||||
struct ParseLocation;
|
||||
class DataType;
|
||||
|
||||
class ParserClient
|
||||
{
|
||||
public:
|
||||
static std::wstring addAccessPrefix(const std::wstring& str, AccessKind access);
|
||||
static std::wstring addStaticPrefix(const std::wstring& str, bool isStatic);
|
||||
static std::wstring addConstPrefix(const std::wstring& str, bool isConst, bool atFront);
|
||||
static std::wstring addLocationSuffix(const std::wstring& str, const ParseLocation& location);
|
||||
static std::wstring addLocationSuffix(
|
||||
const std::wstring& str, const ParseLocation& location, const ParseLocation& scopeLocation);
|
||||
static std::wstring addLocationSuffix(
|
||||
const std::wstring& str,
|
||||
const ParseLocation& location,
|
||||
const ParseLocation& scopeLocation,
|
||||
const ParseLocation& signatureLocation
|
||||
);
|
||||
|
||||
ParserClient();
|
||||
virtual ~ParserClient() = default;
|
||||
|
||||
virtual Id recordSymbol(
|
||||
const NameHierarchy& symbolName, SymbolKind symbolKind,
|
||||
AccessKind access, DefinitionKind definitionKind) = 0;
|
||||
virtual Id recordFile(const FilePath& filePath, bool indexed) = 0;
|
||||
|
||||
virtual Id recordSymbolWithLocation(
|
||||
const NameHierarchy& symbolName, SymbolKind symbolKind,
|
||||
const ParseLocation& location,
|
||||
AccessKind access, DefinitionKind definitionKind) = 0;
|
||||
virtual Id recordSymbol(const NameHierarchy& symbolName) = 0;
|
||||
virtual void recordSymbolKind(Id symbolId, SymbolKind symbolKind) = 0;
|
||||
virtual void recordAccessKind(Id symbolId, AccessKind accessKind) = 0;
|
||||
virtual void recordDefinitionKind(Id symbolId, DefinitionKind definitionKind) = 0;
|
||||
|
||||
virtual Id recordSymbolWithLocationAndScope(
|
||||
const NameHierarchy& symbolName, SymbolKind symbolKind,
|
||||
const ParseLocation& location, const ParseLocation& scopeLocation,
|
||||
AccessKind access, DefinitionKind definitionKind) = 0;
|
||||
|
||||
virtual Id recordSymbolWithLocationAndScopeAndSignature(
|
||||
const NameHierarchy& symbolName, SymbolKind symbolKind,
|
||||
const ParseLocation& location, const ParseLocation& scopeLocation, const ParseLocation& signatureLocation,
|
||||
AccessKind access, DefinitionKind definitionKind) = 0;
|
||||
|
||||
virtual void recordReference(
|
||||
ReferenceKind referenceKind, const NameHierarchy& referencedName, const NameHierarchy& contextName,
|
||||
virtual Id recordReference(ReferenceKind referenceKind, Id referencedSymbolId, Id contextSymbolId,
|
||||
const ParseLocation& location) = 0;
|
||||
|
||||
virtual void recordQualifierLocation(
|
||||
const NameHierarchy& qualifierName, const ParseLocation& location) = 0;
|
||||
|
||||
void recordError(
|
||||
const ParseLocation& errorLocation, const std::wstring& message, bool fatal, bool indexed, const FilePath& translationUnit);
|
||||
|
||||
virtual void recordLocalSymbol(const std::wstring& name, const ParseLocation& location) = 0;
|
||||
virtual void recordFile(const FilePath& filePath, bool indexed) = 0;
|
||||
virtual void recordLocation(Id elementId, const ParseLocation& location, ParseLocationType type) = 0;
|
||||
virtual void recordComment(const ParseLocation& location) = 0;
|
||||
|
||||
bool hasFatalErrors() const;
|
||||
|
||||
protected:
|
||||
virtual void doRecordError(
|
||||
const ParseLocation& errorLocation, const std::wstring& message, bool fatal, bool indexed, const FilePath& translationUnit) = 0;
|
||||
|
||||
bool m_hasFatalErrors;
|
||||
virtual void recordError(const FilePath& filePath, uint lineNumber, uint columnNumber, const std::wstring& message,
|
||||
bool fatal, bool indexed, const FilePath& translationUnit) = 0;
|
||||
};
|
||||
|
||||
#endif // PARSER_CLIENT_H
|
||||
|
||||
Reference in New Issue
Block a user