forked from qt-creator/qt-creator
Get rid of the prefix findOrInsert for the functions in CPlusPlus::Control.
This commit is contained in:
@@ -215,7 +215,7 @@ Document::Document(const QString &fileName)
|
||||
_control->setDiagnosticClient(new DocumentDiagnosticClient(this, &_diagnosticMessages));
|
||||
|
||||
const QByteArray localFileName = fileName.toUtf8();
|
||||
const StringLiteral *fileId = _control->findOrInsertStringLiteral(localFileName.constData(),
|
||||
const StringLiteral *fileId = _control->stringLiteral(localFileName.constData(),
|
||||
localFileName.size());
|
||||
_translationUnit = new TranslationUnit(_control, fileId);
|
||||
_translationUnit->setQtMocRunEnabled(true);
|
||||
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
if (! other)
|
||||
return 0;
|
||||
|
||||
return control()->findOrInsertIdentifier(other->chars(), other->size());
|
||||
return control()->identifier(other->chars(), other->size());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -262,7 +262,7 @@ private:
|
||||
return name;
|
||||
|
||||
else if (const Name *nameId = name->asNameId()) {
|
||||
const Identifier *id = control()->findOrInsertIdentifier(nameId->identifier()->chars(),
|
||||
const Identifier *id = control()->identifier(nameId->identifier()->chars(),
|
||||
nameId->identifier()->size());
|
||||
return control()->nameId(id);
|
||||
|
||||
@@ -272,7 +272,7 @@ private:
|
||||
FullySpecifiedType argTy = templId->templateArgumentAt(templateArgIndex);
|
||||
arguments[templateArgIndex] = q->apply(argTy);
|
||||
}
|
||||
const Identifier *id = control()->findOrInsertIdentifier(templId->identifier()->chars(),
|
||||
const Identifier *id = control()->identifier(templId->identifier()->chars(),
|
||||
templId->identifier()->size());
|
||||
return control()->templateNameId(id, arguments.data(), arguments.size());
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ void FindUsages::operator()(Symbol *symbol)
|
||||
_declSymbolFullyQualifiedName = LookupContext::fullyQualifiedName(symbol);
|
||||
|
||||
// get the canonical id
|
||||
_id = _doc->control()->findOrInsertIdentifier(_id->chars(), _id->size());
|
||||
_id = _doc->control()->identifier(_id->chars(), _id->size());
|
||||
|
||||
if (AST *ast = _doc->translationUnit()->ast())
|
||||
translationUnit(ast->asTranslationUnit());
|
||||
|
||||
@@ -788,6 +788,11 @@ ClassOrNamespace *CreateBindings::enterGlobalClassOrNamespace(Symbol *symbol)
|
||||
return switchCurrentClassOrNamespace(entity);
|
||||
}
|
||||
|
||||
bool CreateBindings::visit(Template *templ)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CreateBindings::visit(Namespace *ns)
|
||||
{
|
||||
ClassOrNamespace *previous = enterClassOrNamespaceBinding(ns);
|
||||
|
||||
@@ -162,6 +162,7 @@ protected:
|
||||
/// Creates bindings for the symbols reachable from the \a root symbol.
|
||||
void process(Symbol *root);
|
||||
|
||||
virtual bool visit(Template *templ);
|
||||
virtual bool visit(Namespace *ns);
|
||||
virtual bool visit(Class *klass);
|
||||
virtual bool visit(ForwardClassDeclaration *klass);
|
||||
|
||||
@@ -234,8 +234,8 @@ bool ResolveExpression::visit(NewExpressionAST *ast)
|
||||
|
||||
bool ResolveExpression::visit(TypeidExpressionAST *)
|
||||
{
|
||||
const Name *stdName = control()->nameId(control()->findOrInsertIdentifier("std"));
|
||||
const Name *tiName = control()->nameId(control()->findOrInsertIdentifier("type_info"));
|
||||
const Name *stdName = control()->nameId(control()->identifier("std"));
|
||||
const Name *tiName = control()->nameId(control()->identifier("type_info"));
|
||||
const Name *q = control()->qualifiedNameId(control()->qualifiedNameId(/* :: */ 0, stdName), tiName);
|
||||
|
||||
FullySpecifiedType ty(control()->namedType(q));
|
||||
|
||||
@@ -140,6 +140,28 @@ void TypePrettyPrinter::visit(Namespace *type)
|
||||
prependCv(_fullySpecifiedType);
|
||||
}
|
||||
|
||||
void TypePrettyPrinter::visit(Template *type)
|
||||
{
|
||||
const unsigned argc = type->templateParameterCount();
|
||||
QString decl;
|
||||
decl += QLatin1String("template <");
|
||||
for (unsigned i = 0; i < argc; ++i) {
|
||||
if (i != 0)
|
||||
decl += QLatin1String(", ");
|
||||
|
||||
decl += QLatin1String("T");
|
||||
decl += QString::number(i + 1);
|
||||
}
|
||||
decl += QLatin1Char('<');
|
||||
if (Symbol *d = type->declaration()) {
|
||||
decl += QLatin1Char(' ');
|
||||
decl += overview()->prettyType(d->type(), d->name());
|
||||
}
|
||||
_text.prepend(decl);
|
||||
qWarning() << "here:" << decl;
|
||||
prependCv(_fullySpecifiedType);
|
||||
}
|
||||
|
||||
void TypePrettyPrinter::visit(Class *classTy)
|
||||
{
|
||||
_text.prepend(overview()->prettyName(classTy->name()));
|
||||
|
||||
@@ -68,6 +68,7 @@ protected:
|
||||
virtual void visit(NamedType *type);
|
||||
virtual void visit(Function *type);
|
||||
virtual void visit(Namespace *type);
|
||||
virtual void visit(Template *type);
|
||||
virtual void visit(Class *type);
|
||||
virtual void visit(Enum *type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user