Пример #1
0
void TypePrettyPrinter::prependSpaceBeforeIndirection(const FullySpecifiedType &type)
{
    const bool elementTypeIsPointerOrReference = type.type()->isPointerType()
        || type.type()->isReferenceType();
    const bool elementIsConstPointerOrReference = elementTypeIsPointerOrReference && type.isConst();
    const bool shouldBindToLeftSpecifier = _overview->starBindFlags & Overview::BindToLeftSpecifier;
    if (elementIsConstPointerOrReference && ! shouldBindToLeftSpecifier)
        _text.prepend(QLatin1String(" "));
}
bool FullySpecifiedType::match(const FullySpecifiedType &otherTy, TypeMatcher *matcher) const
{
    if (_flags != otherTy._flags)
        return false;

    return type()->matchType(otherTy.type(), matcher);
}
Пример #3
0
void TypePrettyPrinter::acceptType(const FullySpecifiedType &ty)
{
    const FullySpecifiedType previousFullySpecifiedType = _fullySpecifiedType;
    _fullySpecifiedType = ty;
    accept(ty.type());
    _fullySpecifiedType = previousFullySpecifiedType;
}
Пример #4
0
bool CheckDeclaration::visit(ObjCMethodDeclarationAST *ast)
{
    if (!ast->method_prototype)
        return false;

    FullySpecifiedType ty = semantic()->check(ast->method_prototype, _scope);
    ObjCMethod *methodType = ty.type()->asObjCMethodType();
    if (!methodType)
        return false;

    Symbol *symbol;
    if (ast->function_body) {
        if (!semantic()->skipFunctionBodies()) {
            semantic()->check(ast->function_body, methodType->members());
        }

        symbol = methodType;
    } else {
        Declaration *decl = control()->newDeclaration(ast->firstToken(), methodType->name());
        decl->setType(methodType);
        symbol = decl;
    }

    symbol->setStartOffset(tokenAt(ast->firstToken()).offset);
    symbol->setEndOffset(tokenAt(ast->lastToken()).offset);
    symbol->setVisibility(semantic()->currentVisibility());

    if (semantic()->isObjCClassMethod(ast->method_prototype->method_type_token))
        symbol->setStorage(Symbol::Static);

    _scope->enterSymbol(symbol);

    return false;
}
Пример #5
0
 void accept(const FullySpecifiedType &ty)
 {
     TypeVisitor::accept(ty.type());
     unsigned flags = ty.flags();
     flags |= temps.back().flags();
     temps.back().setFlags(flags);
 }
Пример #6
0
void CloneType::visit(NamedType *type)
{
    const Name *name = _clone->name(type->name(), _subst);
    FullySpecifiedType ty;
    if (_subst)
        ty = _subst->apply(name);
    if (! ty.isValid())
        ty = _control->namedType(name);
    _type.setType(ty.type());
}
Пример #7
0
void TypePrettyPrinter::acceptType(const FullySpecifiedType &ty)
{
    if (ty.isSigned())
        _text += QLatin1String("signed ");

    else if (ty.isUnsigned())
        _text += QLatin1String("unsigned ");

    const FullySpecifiedType previousFullySpecifiedType = _fullySpecifiedType;
    _fullySpecifiedType = ty;
    accept(ty.type());
    _fullySpecifiedType = previousFullySpecifiedType;
}
Пример #8
0
std::string TypeNameSpeller::spellTypeName(const FullySpecifiedType& fullType,
                                           const CPlusPlus::Scope* scope,
                                           std::string* alpha)
{
    spelling_.clear();
    alpha_ = alpha;

    if (fullType.isUnsigned())
        spelling_.append("unsigned ");

    scope_ = scope;
    accept(fullType.type());

    return spelling_;
}
Пример #9
0
QString CPlusPlus::toString(FullySpecifiedType ty, QString id)
{
    Overview oo;
    return QString::fromLatin1("%0: %1 (a %2)").arg(id, oo.prettyType(ty),
                                                    QLatin1String(ty.type() ? typeid(*ty.type()).name() : "(null)"));
}