forked from qt-creator/qt-creator
CPlusPlus: Make Usage::Type QFlags-based
We want to extend the enum with more non-exclusive values. Change-Id: I4d8ebe1f7327139c7817b9f621b4b74a883c5e09 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -17,18 +17,24 @@ namespace CPlusPlus {
|
||||
class CPLUSPLUS_EXPORT Usage
|
||||
{
|
||||
public:
|
||||
enum class Type { Declaration, Initialization, Read, Write, WritableRef, Other };
|
||||
enum class Tag {
|
||||
Declaration = 1 << 0,
|
||||
Read = 1 << 1,
|
||||
Write = 1 << 2,
|
||||
WritableRef = 1 << 3,
|
||||
};
|
||||
using Tags = QFlags<Tag>;
|
||||
|
||||
Usage() = default;
|
||||
Usage(const Utils::FilePath &path, const QString &lineText, const QString &func, Type t,
|
||||
Usage(const Utils::FilePath &path, const QString &lineText, const QString &func, Tags t,
|
||||
int line, int col, int len)
|
||||
: path(path), lineText(lineText), containingFunction(func), type(t),
|
||||
: path(path), lineText(lineText), containingFunction(func), tags(t),
|
||||
line(line), col(col), len(len) {}
|
||||
|
||||
Utils::FilePath path;
|
||||
QString lineText;
|
||||
QString containingFunction;
|
||||
Type type = Type::Other;
|
||||
Tags tags;
|
||||
int line = 0;
|
||||
int col = 0;
|
||||
int len = 0;
|
||||
@@ -55,7 +61,7 @@ protected:
|
||||
|
||||
void reportResult(unsigned tokenIndex, const Name *name, Scope *scope = nullptr);
|
||||
void reportResult(unsigned tokenIndex, const QList<LookupItem> &candidates);
|
||||
Usage::Type getType(int line, int column, int tokenIndex);
|
||||
Usage::Tags getTags(int line, int column, int tokenIndex);
|
||||
QString getContainingFunction(int line, int column);
|
||||
|
||||
bool checkCandidates(const QList<LookupItem> &candidates) const;
|
||||
@@ -287,7 +293,7 @@ private:
|
||||
TypeOfExpression typeofExpression;
|
||||
Scope *_currentScope = nullptr;
|
||||
const bool _categorize = false;
|
||||
class GetUsageType;
|
||||
class GetUsageTags;
|
||||
};
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
||||
Reference in New Issue
Block a user