Commit dbba0ff8 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Removed the filename literals.

parent 1754aefd
......@@ -110,8 +110,8 @@ Document::Document(const QString &fileName)
_control->setDiagnosticClient(new DocumentDiagnosticClient(this, &_diagnosticMessages));
const QByteArray localFileName = fileName.toUtf8();
StringLiteral *fileId = _control->findOrInsertFileName(localFileName.constData(),
localFileName.size());
StringLiteral *fileId = _control->findOrInsertStringLiteral(localFileName.constData(),
localFileName.size());
_translationUnit = new TranslationUnit(_control, fileId);
_translationUnit->setQtMocRunEnabled(true);
_translationUnit->setObjCEnabled(true);
......
......@@ -449,7 +449,6 @@ public:
LiteralTable<Identifier> identifiers;
LiteralTable<StringLiteral> stringLiterals;
LiteralTable<NumericLiteral> numericLiterals;
LiteralTable<StringLiteral> fileNames;
// ### replace std::map with lookup tables. ASAP!
......@@ -534,12 +533,6 @@ Control::NumericLiteralIterator Control::firstNumericLiteral() const
Control::NumericLiteralIterator Control::lastNumericLiteral() const
{ 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)
{ return d->stringLiterals.findOrInsertLiteral(chars, size); }
......@@ -558,21 +551,6 @@ NumericLiteral *Control::findOrInsertNumericLiteral(const char *chars)
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)
{ return d->findOrInsertNameId(id); }
......
......@@ -153,7 +153,6 @@ public:
typedef const Identifier *const *IdentifierIterator;
typedef const StringLiteral *const *StringLiteralIterator;
typedef const NumericLiteral *const *NumericLiteralIterator;
typedef const StringLiteral *const *FileNameIterator;
IdentifierIterator firstIdentifier() const;
IdentifierIterator lastIdentifier() const;
......@@ -164,21 +163,12 @@ public:
NumericLiteralIterator firstNumericLiteral() const;
NumericLiteralIterator lastNumericLiteral() const;
FileNameIterator firstFileName() const;
FileNameIterator lastFileName() const;
StringLiteral *findOrInsertStringLiteral(const char *chars, unsigned size);
StringLiteral *findOrInsertStringLiteral(const char *chars);
NumericLiteral *findOrInsertNumericLiteral(const char *chars, unsigned size);
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:
class Data;
friend class Data;
......
......@@ -212,8 +212,8 @@ void TranslationUnit::tokenize()
unsigned line = (unsigned) strtoul(tk.spell(), 0, 0);
lex(&tk);
if (! tk.newline && tk.is(T_STRING_LITERAL)) {
StringLiteral *fileName = control()->findOrInsertFileName(tk.string->chars(),
tk.string->size());
StringLiteral *fileName = control()->findOrInsertStringLiteral(tk.string->chars(),
tk.string->size());
pushPreprocessorLine(offset, line, fileName);
lex(&tk);
}
......
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