Get rid of the numeric literals.

This commit is contained in:
Roberto Raggi
2010-09-02 12:50:37 +02:00
parent c12866a467
commit a340cd118e
4 changed files with 21 additions and 0 deletions

View File

@@ -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
} }

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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:
} }
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