aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cpptools/searchsymbols.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-02-25 16:16:11 +0100
committerErik Verbruggen <erik.verbruggen@digia.com>2014-05-28 15:54:38 +0200
commita870c29a71b4de319f83767b55698df627715417 (patch)
treead15b4336e0c2b196e149d06f5ce63743563792e /src/plugins/cpptools/searchsymbols.cpp
parenta940c73d81bf137c7839c6a641ae4291f39fc5cb (diff)
C++: use a global string table for SearchSymbols.
This string table uniques strings, so that multiple identical strings share their contents. It is used by the locator and the symbol searcher, and will later be used by the class view. Change-Id: Ib8b50f69bbf994d0d7a39b66dc8caf1a3d9bfb42 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cpptools/searchsymbols.cpp')
-rw-r--r--src/plugins/cpptools/searchsymbols.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/cpptools/searchsymbols.cpp b/src/plugins/cpptools/searchsymbols.cpp
index c7b2320264b..a166c56f964 100644
--- a/src/plugins/cpptools/searchsymbols.cpp
+++ b/src/plugins/cpptools/searchsymbols.cpp
@@ -42,8 +42,9 @@ SearchSymbols::SymbolTypes SearchSymbols::AllTypes =
| SymbolSearcher::Enums
| SymbolSearcher::Declarations;
-SearchSymbols::SearchSymbols() :
- symbolsToSearchFor(SymbolSearcher::Classes | SymbolSearcher::Functions | SymbolSearcher::Enums)
+SearchSymbols::SearchSymbols(Internal::StringTable &stringTable)
+ : strings(stringTable)
+ , symbolsToSearchFor(SymbolSearcher::Classes | SymbolSearcher::Functions | SymbolSearcher::Enums)
{
}
@@ -62,7 +63,7 @@ QList<ModelItemInfo> SearchSymbols::operator()(Document::Ptr doc, int sizeHint,
}
(void) switchScope(previousScope);
QList<ModelItemInfo> result = items;
- strings.clear();
+ strings.scheduleGC();
items.clear();
m_paths.clear();
return result;
@@ -291,7 +292,7 @@ void SearchSymbols::appendItem(const QString &symbolName, const QString &symbolT
findOrInsert(symbolType),
findOrInsert(symbolScope),
itemType,
- path,
+ findOrInsert(path),
symbol->line(),
symbol->column() - 1, // 1-based vs 0-based column
icon));