예제 #1
0
CVQualifiers 
FunctionInvocation::get_qualifiers(void) const
{
	CVQualifiers qfer;
	if (invoke_type == eFuncCall) { 
		const FunctionInvocationUser* func_call = dynamic_cast<const FunctionInvocationUser*>(this);
		assert(func_call->get_func());
		assert(func_call->get_func()->rv);
		qfer = func_call->get_func()->rv->qfer;
	}
	// for binary and unary operations, they only yield integers right now (no pointer arithmatic
	// supported yet!), we assume they return non-const non-volatile int
	else {
		qfer.add_qualifiers(false, false);
	}
	return qfer;
}
예제 #2
0
static void
GenerateParameterListFromString(Function &currFunc, const string &params_string)
{
    vector<string> vs;
    StringUtils::split_string(params_string, vs, ",");
    int params_cnt = vs.size();
    assert((params_cnt > 0) && "Invalid params_string!");
    if ((params_cnt == 1) && (vs[0] == "Void")) {
        return;
    }
    for (int i = 0; i < params_cnt; i++) {
        assert((vs[i] != "Void") && "Invalid parameter type!");
        CVQualifiers qfer;
        qfer.add_qualifiers(false, false);
        const Type *ty = Type::get_type_from_string(vs[0]);
        Variable *v = VariableSelector::GenerateParameterVariable(ty, &qfer);
        assert(v);
        currFunc.param.push_back(v);
    }
}