Skip to content
Snippets Groups Projects
Commit dbba0ff8 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Removed the filename literals.

parent 1754aefd
No related branches found
No related tags found
No related merge requests found
...@@ -110,8 +110,8 @@ Document::Document(const QString &fileName) ...@@ -110,8 +110,8 @@ Document::Document(const QString &fileName)
_control->setDiagnosticClient(new DocumentDiagnosticClient(this, &_diagnosticMessages)); _control->setDiagnosticClient(new DocumentDiagnosticClient(this, &_diagnosticMessages));
const QByteArray localFileName = fileName.toUtf8(); const QByteArray localFileName = fileName.toUtf8();
StringLiteral *fileId = _control->findOrInsertFileName(localFileName.constData(), StringLiteral *fileId = _control->findOrInsertStringLiteral(localFileName.constData(),
localFileName.size()); localFileName.size());
_translationUnit = new TranslationUnit(_control, fileId); _translationUnit = new TranslationUnit(_control, fileId);
_translationUnit->setQtMocRunEnabled(true); _translationUnit->setQtMocRunEnabled(true);
_translationUnit->setObjCEnabled(true); _translationUnit->setObjCEnabled(true);
......
...@@ -449,7 +449,6 @@ public: ...@@ -449,7 +449,6 @@ public:
LiteralTable<Identifier> identifiers; LiteralTable<Identifier> identifiers;
LiteralTable<StringLiteral> stringLiterals; LiteralTable<StringLiteral> stringLiterals;
LiteralTable<NumericLiteral> numericLiterals; LiteralTable<NumericLiteral> numericLiterals;
LiteralTable<StringLiteral> fileNames;
// ### replace std::map with lookup tables. ASAP! // ### replace std::map with lookup tables. ASAP!
...@@ -534,12 +533,6 @@ Control::NumericLiteralIterator Control::firstNumericLiteral() const ...@@ -534,12 +533,6 @@ Control::NumericLiteralIterator Control::firstNumericLiteral() const
Control::NumericLiteralIterator Control::lastNumericLiteral() const Control::NumericLiteralIterator Control::lastNumericLiteral() const
{ return d->numericLiterals.end(); } { return d->numericLiterals.end(); }
Control::FileNameIterator Control::firstFileName() const
{ return d->fileNames.begin(); }
Control::FileNameIterator Control::lastFileName() const
{ return d->fileNames.end(); }
StringLiteral *Control::findOrInsertStringLiteral(const char *chars, unsigned size) StringLiteral *Control::findOrInsertStringLiteral(const char *chars, unsigned size)
{ return d->stringLiterals.findOrInsertLiteral(chars, size); } { return d->stringLiterals.findOrInsertLiteral(chars, size); }
...@@ -558,21 +551,6 @@ NumericLiteral *Control::findOrInsertNumericLiteral(const char *chars) ...@@ -558,21 +551,6 @@ NumericLiteral *Control::findOrInsertNumericLiteral(const char *chars)
return findOrInsertNumericLiteral(chars, length); return findOrInsertNumericLiteral(chars, length);
} }
unsigned Control::fileNameCount() const
{ return d->fileNames.size(); }
StringLiteral *Control::fileNameAt(unsigned index) const
{ return d->fileNames.at(index); }
StringLiteral *Control::findOrInsertFileName(const char *chars, unsigned size)
{ return d->fileNames.findOrInsertLiteral(chars, size); }
StringLiteral *Control::findOrInsertFileName(const char *chars)
{
unsigned length = std::char_traits<char>::length(chars);
return findOrInsertFileName(chars, length);
}
NameId *Control::nameId(Identifier *id) NameId *Control::nameId(Identifier *id)
{ return d->findOrInsertNameId(id); } { return d->findOrInsertNameId(id); }
......
...@@ -153,7 +153,6 @@ public: ...@@ -153,7 +153,6 @@ public:
typedef const Identifier *const *IdentifierIterator; typedef const Identifier *const *IdentifierIterator;
typedef const StringLiteral *const *StringLiteralIterator; typedef const StringLiteral *const *StringLiteralIterator;
typedef const NumericLiteral *const *NumericLiteralIterator; typedef const NumericLiteral *const *NumericLiteralIterator;
typedef const StringLiteral *const *FileNameIterator;
IdentifierIterator firstIdentifier() const; IdentifierIterator firstIdentifier() const;
IdentifierIterator lastIdentifier() const; IdentifierIterator lastIdentifier() const;
...@@ -164,21 +163,12 @@ public: ...@@ -164,21 +163,12 @@ public:
NumericLiteralIterator firstNumericLiteral() const; NumericLiteralIterator firstNumericLiteral() const;
NumericLiteralIterator lastNumericLiteral() const; NumericLiteralIterator lastNumericLiteral() const;
FileNameIterator firstFileName() const;
FileNameIterator lastFileName() const;
StringLiteral *findOrInsertStringLiteral(const char *chars, unsigned size); StringLiteral *findOrInsertStringLiteral(const char *chars, unsigned size);
StringLiteral *findOrInsertStringLiteral(const char *chars); StringLiteral *findOrInsertStringLiteral(const char *chars);
NumericLiteral *findOrInsertNumericLiteral(const char *chars, unsigned size); NumericLiteral *findOrInsertNumericLiteral(const char *chars, unsigned size);
NumericLiteral *findOrInsertNumericLiteral(const char *chars); NumericLiteral *findOrInsertNumericLiteral(const char *chars);
StringLiteral *findOrInsertFileName(const char *chars, unsigned size);
StringLiteral *findOrInsertFileName(const char *chars);
unsigned fileNameCount() const;
StringLiteral *fileNameAt(unsigned index) const;
private: private:
class Data; class Data;
friend class Data; friend class Data;
......
...@@ -212,8 +212,8 @@ void TranslationUnit::tokenize() ...@@ -212,8 +212,8 @@ void TranslationUnit::tokenize()
unsigned line = (unsigned) strtoul(tk.spell(), 0, 0); unsigned line = (unsigned) strtoul(tk.spell(), 0, 0);
lex(&tk); lex(&tk);
if (! tk.newline && tk.is(T_STRING_LITERAL)) { if (! tk.newline && tk.is(T_STRING_LITERAL)) {
StringLiteral *fileName = control()->findOrInsertFileName(tk.string->chars(), StringLiteral *fileName = control()->findOrInsertStringLiteral(tk.string->chars(),
tk.string->size()); tk.string->size());
pushPreprocessorLine(offset, line, fileName); pushPreprocessorLine(offset, line, fileName);
lex(&tk); lex(&tk);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment