当前位置: 首页>>代码示例>>C++>>正文


C++ Argument::setType方法代码示例

本文整理汇总了C++中Argument::setType方法的典型用法代码示例。如果您正苦于以下问题:C++ Argument::setType方法的具体用法?C++ Argument::setType怎么用?C++ Argument::setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Argument的用法示例。


在下文中一共展示了Argument::setType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: visit

bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
{
    unsigned sourceLocation = locationOfDeclaratorId(ast->declarator);
    if (! sourceLocation) {
        if (ast->declarator)
            sourceLocation = ast->declarator->firstToken();
        else
            sourceLocation = ast->firstToken();
    }

    const Name *argName = 0;
    FullySpecifiedType ty = semantic()->check(ast->type_specifier_list, _scope);
    FullySpecifiedType argTy = semantic()->check(ast->declarator, ty.qualifiedType(),
                                                 _scope, &argName);
    FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
    Argument *arg = control()->newArgument(sourceLocation, argName);
    ast->symbol = arg;
    if (ast->expression) {
        unsigned startOfExpression = ast->expression->firstToken();
        unsigned endOfExpression = ast->expression->lastToken();
        std::string buffer;
        for (unsigned index = startOfExpression; index != endOfExpression; ++index) {
            const Token &tk = tokenAt(index);
            if (tk.whitespace() || tk.newline())
                buffer += ' ';
            buffer += tk.spell();
        }
        const StringLiteral *initializer = control()->findOrInsertStringLiteral(buffer.c_str(), buffer.size());
        arg->setInitializer(initializer);
    }
    arg->setType(argTy);
    _scope->enterSymbol(arg);
    return false;
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: visit

        virtual void visit(Function *type)
        {
            Function *funTy = control()->newFunction(0, 0);
            funTy->copy(type);
            funTy->setConst(type->isConst());
            funTy->setVolatile(type->isVolatile());

            funTy->setName(rewrite->rewriteName(type->name()));

            funTy->setReturnType(rewrite->rewriteType(type->returnType()));

            for (unsigned i = 0, argc = type->argumentCount(); i < argc; ++i) {
                Symbol *arg = type->argumentAt(i);

                Argument *newArg = control()->newArgument(0, 0);
                newArg->copy(arg);
                newArg->setName(rewrite->rewriteName(arg->name()));
                newArg->setType(rewrite->rewriteType(arg->type()));

                // the copy() call above set the scope to 'type'
                // reset it to 0 before adding addMember to avoid assert
                newArg->resetEnclosingScope();
                funTy->addMember(newArg);
            }

            temps.append(funTy);
        }
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:27,代码来源:CppRewriter.cpp

示例3: Argument

Argument *Engine::newArgument(Function *function, const QString &name, const Type *type)
{
    Argument *a = new Argument(function);
    a->setName(name);
    a->setType(type);
    _symbols.append(a);
    return a;
}
开发者ID:KDE,项目名称:android-qt-creator,代码行数:8,代码来源:glslengine.cpp

示例4: visit

bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
{
    unsigned sourceLocation = locationOfDeclaratorId(ast->declarator);
    if (! sourceLocation) {
        if (ast->declarator)
            sourceLocation = ast->declarator->firstToken();
        else
            sourceLocation = ast->firstToken();
    }

    Name *argName = 0;
    FullySpecifiedType ty = semantic()->check(ast->type_specifier, _scope);
    FullySpecifiedType argTy = semantic()->check(ast->declarator, ty.qualifiedType(),
                                                 _scope, &argName);
    FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
    Argument *arg = control()->newArgument(sourceLocation, argName);
    ast->symbol = arg;
    if (ast->expression)
        arg->setInitializer(true);
    arg->setType(argTy);
    _scope->enterSymbol(arg);
    return false;
}
开发者ID:halsten,项目名称:beaverdbg,代码行数:23,代码来源:CheckDeclaration.cpp

示例5: Argument

Argument *arg(const QString &name, const FullySpecifiedType &ty)
{
    Argument *a = new Argument(unit, 0, nameId(name));
    a->setType(ty);
    return a;
}
开发者ID:,项目名称:,代码行数:6,代码来源:

示例6: if

bool X86RTLGenerator::parseArgument(x86_op_t *pOp, Argument &aArgument)
{
	if(!pOp)
	{
		return false;
	}

	switch(pOp->type)
	{
		case op_register:
		{
			aArgument.setType(Argument::TYPE_REGISTER);
			std::string strRegisterName = pOp->data.reg.name;

			if(strRegisterName == "ah")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_EAX);
				aArgument.setDataWidth(Argument::DATA_WIDTH_8_LW_HB);
			}
			else if(strRegisterName == "al")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_EAX);
				aArgument.setDataWidth(Argument::DATA_WIDTH_8_LW_LB);
			}
			else if(strRegisterName == "ax")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_EAX);
				aArgument.setDataWidth(Argument::DATA_WIDTH_16_LW);
			}
			else if(strRegisterName == "eax")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_EAX);
				aArgument.setDataWidth(Argument::DATA_WIDTH_32);
			}
			else if(strRegisterName == "esi")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_ESI);
				aArgument.setDataWidth(Argument::DATA_WIDTH_32);
			}
			else if(strRegisterName == "esp")
			{
				aArgument.setRegister((Argument::eRegister)REGISTER_X86_ESP);
				aArgument.setDataWidth(Argument::DATA_WIDTH_32);
			}
			else
				return false;
			break;
		}
		case op_immediate:
			aArgument.setType(Argument::TYPE_VALUE);

			switch(pOp->datatype)
			{
				case op_byte:
					aArgument.setValue(pOp->data.byte);
					aArgument.setDataWidth(Argument::DATA_WIDTH_8_LW_LB);
					break;
				default:
					return false;
			}
			break;
		case op_expression:
			aArgument.setType(Argument::TYPE_MEMORY_LOC);
			break;
		case op_offset:
			aArgument.setType(Argument::TYPE_MEMORY_LOC);
			break;
		case op_relative_far:
			aArgument.setType(Argument::TYPE_VALUE);
			break;
		case op_relative_near:
			aArgument.setType(Argument::TYPE_VALUE);
			break;
		default:
			return false;
	}

	return true;
}
开发者ID:BackupTheBerlios,项目名称:tuxap,代码行数:79,代码来源:X86RTLGenerator.cpp


注:本文中的Argument::setType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。