diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index faf1650a02532aae5b82a3f442761df88eb750c9..d1415bb281b8e7d47713016ce213f63714515e57 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -287,6 +287,9 @@ public: _doc->check(_mode); _doc->releaseTranslationUnit(); + if (_mode == Document::FastCheck) + _doc->control()->squeeze(); + if (_modelManager) _modelManager->emitDocumentUpdated(_doc); // ### TODO: compress } diff --git a/src/shared/cplusplus/Control.cpp b/src/shared/cplusplus/Control.cpp index 14e302a0399c89e13fb1af1918ee123bccaea90f..647b17ce3577a8b09740306148ee616d386418f5 100644 --- a/src/shared/cplusplus/Control.cpp +++ b/src/shared/cplusplus/Control.cpp @@ -754,3 +754,8 @@ bool Control::hasSymbol(Symbol *symbol) const { return std::find(d->symbols.begin(), d->symbols.end(), symbol) != d->symbols.end(); } + +void Control::squeeze() +{ + d->numericLiterals.reset(); +} diff --git a/src/shared/cplusplus/Control.h b/src/shared/cplusplus/Control.h index 78839fb1e5d0d3e8053a938462402e5802d789f2..69c6dceae6a2b4940383c3ac705005fc75d9d64f 100644 --- a/src/shared/cplusplus/Control.h +++ b/src/shared/cplusplus/Control.h @@ -211,6 +211,8 @@ public: bool hasSymbol(Symbol *symbol) const; + void squeeze(); + private: class Data; friend class Data; diff --git a/src/shared/cplusplus/LiteralTable.h b/src/shared/cplusplus/LiteralTable.h index 80ada26e51af901849c881ea349f1431a73ec182..1c85c6f13a04c78c80f6ab65fd15ea50fc5c0147 100644 --- a/src/shared/cplusplus/LiteralTable.h +++ b/src/shared/cplusplus/LiteralTable.h @@ -73,6 +73,11 @@ public: { } ~LiteralTable() + { + reset(); + } + + void reset() { if (_literals) { _Literal **lastLiteral = _literals + _literalCount + 1; @@ -82,6 +87,12 @@ public: } if (_buckets) std::free(_buckets); + + _literals = 0; + _buckets = 0; + _allocatedLiterals = 0; + _literalCount = -1; + _allocatedBuckets = 0; } bool empty() const