Commit a340cd11 authored by Roberto Raggi's avatar Roberto Raggi

Get rid of the numeric literals.

parent c12866a4
...@@ -287,6 +287,9 @@ public: ...@@ -287,6 +287,9 @@ public:
_doc->check(_mode); _doc->check(_mode);
_doc->releaseTranslationUnit(); _doc->releaseTranslationUnit();
if (_mode == Document::FastCheck)
_doc->control()->squeeze();
if (_modelManager) if (_modelManager)
_modelManager->emitDocumentUpdated(_doc); // ### TODO: compress _modelManager->emitDocumentUpdated(_doc); // ### TODO: compress
} }
......
...@@ -754,3 +754,8 @@ bool Control::hasSymbol(Symbol *symbol) const ...@@ -754,3 +754,8 @@ bool Control::hasSymbol(Symbol *symbol) const
{ {
return std::find(d->symbols.begin(), d->symbols.end(), symbol) != d->symbols.end(); return std::find(d->symbols.begin(), d->symbols.end(), symbol) != d->symbols.end();
} }
void Control::squeeze()
{
d->numericLiterals.reset();
}
...@@ -211,6 +211,8 @@ public: ...@@ -211,6 +211,8 @@ public:
bool hasSymbol(Symbol *symbol) const; bool hasSymbol(Symbol *symbol) const;
void squeeze();
private: private:
class Data; class Data;
friend class Data; friend class Data;
......
...@@ -73,6 +73,11 @@ public: ...@@ -73,6 +73,11 @@ public:
{ } { }
~LiteralTable() ~LiteralTable()
{
reset();
}
void reset()
{ {
if (_literals) { if (_literals) {
_Literal **lastLiteral = _literals + _literalCount + 1; _Literal **lastLiteral = _literals + _literalCount + 1;
...@@ -82,6 +87,12 @@ public: ...@@ -82,6 +87,12 @@ public:
} }
if (_buckets) if (_buckets)
std::free(_buckets); std::free(_buckets);
_literals = 0;
_buckets = 0;
_allocatedLiterals = 0;
_literalCount = -1;
_allocatedBuckets = 0;
} }
bool empty() const bool empty() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment