forked from qt-creator/qt-creator
Get rid of the prefix findOrInsert for the functions in CPlusPlus::Control.
This commit is contained in:
@@ -437,7 +437,7 @@ bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
|
||||
buffer += ' ';
|
||||
buffer += tk.spell();
|
||||
}
|
||||
const StringLiteral *initializer = control()->findOrInsertStringLiteral(buffer.c_str(), buffer.size());
|
||||
const StringLiteral *initializer = control()->stringLiteral(buffer.c_str(), buffer.size());
|
||||
arg->setInitializer(initializer);
|
||||
}
|
||||
arg->setType(argTy);
|
||||
|
||||
@@ -377,7 +377,7 @@ bool CheckName::visit(ObjCSelectorAST *ast)
|
||||
bool hasArgs = false;
|
||||
for (ObjCSelectorArgumentListAST *it = ast->selector_argument_list; it; it = it->next) {
|
||||
if (it->value->name_token) {
|
||||
const Identifier *id = control()->findOrInsertIdentifier(spell(it->value->name_token));
|
||||
const Identifier *id = control()->identifier(spell(it->value->name_token));
|
||||
const NameId *nameId = control()->nameId(id);
|
||||
names.push_back(nameId);
|
||||
|
||||
|
||||
@@ -377,9 +377,9 @@ bool CheckStatement::visit(QtMemberDeclarationAST *ast)
|
||||
const Name *name = 0;
|
||||
|
||||
if (tokenKind(ast->q_token) == T_Q_D)
|
||||
name = control()->nameId(control()->findOrInsertIdentifier("d"));
|
||||
name = control()->nameId(control()->identifier("d"));
|
||||
else
|
||||
name = control()->nameId(control()->findOrInsertIdentifier("q"));
|
||||
name = control()->nameId(control()->identifier("q"));
|
||||
|
||||
FullySpecifiedType declTy = semantic()->check(ast->type_id, _scope);
|
||||
|
||||
@@ -390,7 +390,7 @@ bool CheckStatement::visit(QtMemberDeclarationAST *ast)
|
||||
privateClass += nameId->identifier()->chars();
|
||||
privateClass += "Private";
|
||||
|
||||
const Name *privName = control()->nameId(control()->findOrInsertIdentifier(privateClass.c_str(),
|
||||
const Name *privName = control()->nameId(control()->identifier(privateClass.c_str(),
|
||||
privateClass.size()));
|
||||
declTy.setType(control()->namedType(privName));
|
||||
}
|
||||
|
||||
@@ -536,17 +536,17 @@ Control::Control()
|
||||
{
|
||||
d = new Data(this);
|
||||
|
||||
d->deprecatedId = findOrInsertIdentifier("deprecated");
|
||||
d->unavailableId = findOrInsertIdentifier("unavailable");
|
||||
d->deprecatedId = identifier("deprecated");
|
||||
d->unavailableId = identifier("unavailable");
|
||||
|
||||
d->objcGetterId = findOrInsertIdentifier("getter");
|
||||
d->objcSetterId = findOrInsertIdentifier("setter");
|
||||
d->objcReadwriteId = findOrInsertIdentifier("readwrite");
|
||||
d->objcReadonlyId = findOrInsertIdentifier("readonly");
|
||||
d->objcAssignId = findOrInsertIdentifier("assign");
|
||||
d->objcRetainId = findOrInsertIdentifier("retain");
|
||||
d->objcCopyId = findOrInsertIdentifier("copy");
|
||||
d->objcNonatomicId = findOrInsertIdentifier("nonatomic");
|
||||
d->objcGetterId = identifier("getter");
|
||||
d->objcSetterId = identifier("setter");
|
||||
d->objcReadwriteId = identifier("readwrite");
|
||||
d->objcReadonlyId = identifier("readonly");
|
||||
d->objcAssignId = identifier("assign");
|
||||
d->objcRetainId = identifier("retain");
|
||||
d->objcCopyId = identifier("copy");
|
||||
d->objcNonatomicId = identifier("nonatomic");
|
||||
}
|
||||
|
||||
Control::~Control()
|
||||
@@ -571,13 +571,13 @@ void Control::setDiagnosticClient(DiagnosticClient *diagnosticClient)
|
||||
const Identifier *Control::findIdentifier(const char *chars, unsigned size) const
|
||||
{ return d->identifiers.findLiteral(chars, size); }
|
||||
|
||||
const Identifier *Control::findOrInsertIdentifier(const char *chars, unsigned size)
|
||||
const Identifier *Control::identifier(const char *chars, unsigned size)
|
||||
{ return d->identifiers.findOrInsertLiteral(chars, size); }
|
||||
|
||||
const Identifier *Control::findOrInsertIdentifier(const char *chars)
|
||||
const Identifier *Control::identifier(const char *chars)
|
||||
{
|
||||
unsigned length = std::strlen(chars);
|
||||
return findOrInsertIdentifier(chars, length);
|
||||
return identifier(chars, length);
|
||||
}
|
||||
|
||||
Control::IdentifierIterator Control::firstIdentifier() const
|
||||
@@ -598,22 +598,22 @@ Control::NumericLiteralIterator Control::firstNumericLiteral() const
|
||||
Control::NumericLiteralIterator Control::lastNumericLiteral() const
|
||||
{ return d->numericLiterals.end(); }
|
||||
|
||||
const StringLiteral *Control::findOrInsertStringLiteral(const char *chars, unsigned size)
|
||||
const StringLiteral *Control::stringLiteral(const char *chars, unsigned size)
|
||||
{ return d->stringLiterals.findOrInsertLiteral(chars, size); }
|
||||
|
||||
const StringLiteral *Control::findOrInsertStringLiteral(const char *chars)
|
||||
const StringLiteral *Control::stringLiteral(const char *chars)
|
||||
{
|
||||
unsigned length = std::strlen(chars);
|
||||
return findOrInsertStringLiteral(chars, length);
|
||||
return stringLiteral(chars, length);
|
||||
}
|
||||
|
||||
const NumericLiteral *Control::findOrInsertNumericLiteral(const char *chars, unsigned size)
|
||||
const NumericLiteral *Control::numericLiteral(const char *chars, unsigned size)
|
||||
{ return d->numericLiterals.findOrInsertLiteral(chars, size); }
|
||||
|
||||
const NumericLiteral *Control::findOrInsertNumericLiteral(const char *chars)
|
||||
const NumericLiteral *Control::numericLiteral(const char *chars)
|
||||
{
|
||||
unsigned length = std::strlen(chars);
|
||||
return findOrInsertNumericLiteral(chars, length);
|
||||
return numericLiteral(chars, length);
|
||||
}
|
||||
|
||||
const NameId *Control::nameId(const Identifier *id)
|
||||
|
||||
@@ -190,8 +190,8 @@ public:
|
||||
const Identifier *objcNonatomicId() const;
|
||||
|
||||
const Identifier *findIdentifier(const char *chars, unsigned size) const;
|
||||
const Identifier *findOrInsertIdentifier(const char *chars, unsigned size);
|
||||
const Identifier *findOrInsertIdentifier(const char *chars);
|
||||
const Identifier *identifier(const char *chars, unsigned size);
|
||||
const Identifier *identifier(const char *chars);
|
||||
|
||||
typedef const Identifier *const *IdentifierIterator;
|
||||
typedef const StringLiteral *const *StringLiteralIterator;
|
||||
@@ -206,11 +206,11 @@ public:
|
||||
NumericLiteralIterator firstNumericLiteral() const;
|
||||
NumericLiteralIterator lastNumericLiteral() const;
|
||||
|
||||
const StringLiteral *findOrInsertStringLiteral(const char *chars, unsigned size);
|
||||
const StringLiteral *findOrInsertStringLiteral(const char *chars);
|
||||
const StringLiteral *stringLiteral(const char *chars, unsigned size);
|
||||
const StringLiteral *stringLiteral(const char *chars);
|
||||
|
||||
const NumericLiteral *findOrInsertNumericLiteral(const char *chars, unsigned size);
|
||||
const NumericLiteral *findOrInsertNumericLiteral(const char *chars);
|
||||
const NumericLiteral *numericLiteral(const char *chars, unsigned size);
|
||||
const NumericLiteral *numericLiteral(const char *chars);
|
||||
|
||||
bool hasSymbol(Symbol *symbol) const;
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ void Lexer::scan_helper(Token *tok)
|
||||
yyinp();
|
||||
|
||||
if (control())
|
||||
tok->string = control()->findOrInsertStringLiteral(yytext, yylen);
|
||||
tok->string = control()->stringLiteral(yytext, yylen);
|
||||
} break;
|
||||
|
||||
case '{':
|
||||
@@ -361,7 +361,7 @@ void Lexer::scan_helper(Token *tok)
|
||||
int yylen = _currentChar - yytext;
|
||||
tok->f.kind = T_NUMERIC_LITERAL;
|
||||
if (control())
|
||||
tok->number = control()->findOrInsertNumericLiteral(yytext, yylen);
|
||||
tok->number = control()->numericLiteral(yytext, yylen);
|
||||
} else {
|
||||
tok->f.kind = T_DOT;
|
||||
}
|
||||
@@ -564,7 +564,7 @@ void Lexer::scan_helper(Token *tok)
|
||||
if (_yychar == '>')
|
||||
yyinp();
|
||||
if (control())
|
||||
tok->string = control()->findOrInsertStringLiteral(yytext, yylen);
|
||||
tok->string = control()->stringLiteral(yytext, yylen);
|
||||
tok->f.kind = T_ANGLE_STRING_LITERAL;
|
||||
} else if (_yychar == '<') {
|
||||
yyinp();
|
||||
@@ -642,7 +642,7 @@ void Lexer::scan_helper(Token *tok)
|
||||
yyinp();
|
||||
|
||||
if (control())
|
||||
tok->string = control()->findOrInsertStringLiteral(yytext, yylen);
|
||||
tok->string = control()->stringLiteral(yytext, yylen);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -679,7 +679,7 @@ void Lexer::scan_helper(Token *tok)
|
||||
yyinp();
|
||||
|
||||
if (control())
|
||||
tok->string = control()->findOrInsertStringLiteral(yytext, yylen);
|
||||
tok->string = control()->stringLiteral(yytext, yylen);
|
||||
} else if (std::isalpha(ch) || ch == '_' || ch == '$') {
|
||||
const char *yytext = _currentChar - 1;
|
||||
while (std::isalnum(_yychar) || _yychar == '_' || _yychar == '$')
|
||||
@@ -694,7 +694,7 @@ void Lexer::scan_helper(Token *tok)
|
||||
tok->f.kind = classifyOperator(yytext, yylen);
|
||||
|
||||
if (control())
|
||||
tok->identifier = control()->findOrInsertIdentifier(yytext, yylen);
|
||||
tok->identifier = control()->identifier(yytext, yylen);
|
||||
}
|
||||
break;
|
||||
} else if (std::isdigit(ch)) {
|
||||
@@ -715,7 +715,7 @@ void Lexer::scan_helper(Token *tok)
|
||||
int yylen = _currentChar - yytext;
|
||||
tok->f.kind = T_NUMERIC_LITERAL;
|
||||
if (control())
|
||||
tok->number = control()->findOrInsertNumericLiteral(yytext, yylen);
|
||||
tok->number = control()->numericLiteral(yytext, yylen);
|
||||
break;
|
||||
} else {
|
||||
tok->f.kind = T_ERROR;
|
||||
|
||||
@@ -188,8 +188,8 @@ void TranslationUnit::tokenize()
|
||||
pushLineOffset(0);
|
||||
pushPreprocessorLine(0, 1, fileId());
|
||||
|
||||
const Identifier *lineId = control()->findOrInsertIdentifier("line");
|
||||
const Identifier *genId = control()->findOrInsertIdentifier("gen");
|
||||
const Identifier *lineId = control()->identifier("line");
|
||||
const Identifier *genId = control()->identifier("gen");
|
||||
|
||||
bool generated = false;
|
||||
Token tk;
|
||||
@@ -218,7 +218,7 @@ void TranslationUnit::tokenize()
|
||||
unsigned line = (unsigned) strtoul(tk.spell(), 0, 0);
|
||||
lex(&tk);
|
||||
if (! tk.f.newline && tk.is(T_STRING_LITERAL)) {
|
||||
const StringLiteral *fileName = control()->findOrInsertStringLiteral(tk.string->chars(),
|
||||
const StringLiteral *fileName = control()->stringLiteral(tk.string->chars(),
|
||||
tk.string->size());
|
||||
pushPreprocessorLine(offset, line, fileName);
|
||||
lex(&tk);
|
||||
|
||||
Reference in New Issue
Block a user