summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/FindUsages.h
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-08-28 14:07:16 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-09-03 14:32:47 +0000
commit45dd074441b4477e9bd90a61c4875f70bda2feda (patch)
tree560b3263418a5c459f551d7acf77648c4c27076f /src/libs/cplusplus/FindUsages.h
parent0ceb9f487c64b06a2298d0cff1186a3c6d0d0001 (diff)
downloadqt-creator-45dd074441b4477e9bd90a61c4875f70bda2feda.tar.gz
CPlusPlus: Categorize "Find Usages" results
That is, find out whether a certain access was a read, a write, a declaration or something else, and report the result to upper layers. Follow-up patches can make this information visible to users. Task-number: QTCREATORBUG-12734 Task-number: QTCREATORBUG-19373 Change-Id: Iee79e39dd1eb5a986a7e27846991e0e01b2c3a2f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/libs/cplusplus/FindUsages.h')
-rw-r--r--src/libs/cplusplus/FindUsages.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libs/cplusplus/FindUsages.h b/src/libs/cplusplus/FindUsages.h
index e0b37b12a8..a0e1130c15 100644
--- a/src/libs/cplusplus/FindUsages.h
+++ b/src/libs/cplusplus/FindUsages.h
@@ -39,13 +39,15 @@ namespace CPlusPlus {
class CPLUSPLUS_EXPORT Usage
{
public:
+ enum class Type { Declaration, Read, Write, WritableRef, Other };
+
Usage() = default;
- Usage(const Utils::FilePath &path, const QString &lineText, int line, int col, int len)
- : path(path), lineText(lineText), line(line), col(col), len(len) {}
+ Usage(const Utils::FilePath &path, const QString &lineText, Type t, int line, int col, int len)
+ : path(path), lineText(lineText), type(t), line(line), col(col), len(len) {}
-public:
Utils::FilePath path;
QString lineText;
+ Type type = Type::Other;
int line = 0;
int col = 0;
int len = 0;
@@ -71,6 +73,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);
bool checkCandidates(const QList<LookupItem> &candidates) const;
void checkExpression(unsigned startToken, unsigned endToken, Scope *scope = nullptr);