summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2019-08-21 14:33:13 +0200
committerTim Jenssen <tim.jenssen@qt.io>2019-08-29 07:53:24 +0000
commit20a304c8e09029c122aa583f5e3337b3ebe92111 (patch)
tree94039c1aa8ade69fc7ade20c3cc0fb5bf5dba5a8 /src/plugins/cpptools
parent246277c5703140cc3a192661cf5119adc4fb34f6 (diff)
downloadqt-creator-20a304c8e09029c122aa583f5e3337b3ebe92111.tar.gz
CppEditor: Reuse document for search results
Instead of open a document for every entry we do open it only once per search. For that we sort the entries by file path, so that they are clustered together and reuse the last document if the path hasn't changed. This can improve the calculations of the search results drastically. Change-Id: I9c9c1e387624297d84c6a2ca6edb6130f739d295 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r--src/plugins/cpptools/usages.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/cpptools/usages.h b/src/plugins/cpptools/usages.h
index 1e0f502c5e..3248fc4e90 100644
--- a/src/plugins/cpptools/usages.h
+++ b/src/plugins/cpptools/usages.h
@@ -51,6 +51,12 @@ public:
&& first.path == second.path;
}
+ friend bool operator<(const Usage &first, const Usage &second)
+ {
+ return std::tie(first.path, first.line, first.column)
+ < std::tie(second.path, second.line, second.column);
+ }
+
public:
QString path;
int line = 0;