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


C++ Iter::is_valid方法代码示例

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


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

示例1: do_file_set_block

void MultiDimArrayDismantlerPass::do_file_set_block( FileSetBlock* file_set_block ) {
    SuifEnv *env = get_suif_env();
    TypeBuilder *type_builder = (TypeBuilder *)
          env->get_object_factory(TypeBuilder::get_class_name());
    suif_hash_map<MultiDimArrayType *,Type *> type_map;
    ReplacingWalker walker(env);

    list<MultiDimArrayType *> type_list;

    for (Iter<MultiDimArrayType> titer =
                object_iterator<MultiDimArrayType>(file_set_block);
         titer.is_valid(); titer.next()) 
    {
        MultiDimArrayType *type = &titer.current();
	    type_list.push_back(type);
	}

    for (list<MultiDimArrayType *>::iterator tliter = type_list.begin();tliter != type_list.end();tliter ++) {
	    MultiDimArrayType *type = *tliter;
	    Type *rep_type = disassemble_multi_array_type(env,type_builder,type);
	    type_map.enter_value(type,rep_type);
	    to<BasicSymbolTable>(type->get_parent())->remove_symbol_table_object(type);
	    walker.add_replacement(type,rep_type);
    }

    for (Iter<MultiDimArrayExpression> iter = 
		object_iterator<MultiDimArrayExpression>(file_set_block);
        iter.is_valid(); iter.next()) 
    {
    	MultiDimArrayExpression *expr = &iter.current();
    	dismantle_multi_dim_array_expression(env,expr,type_builder,type_map);
	}
    file_set_block->walk(walker);
};
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:34,代码来源:array_dismantlers.cpp

示例2: is_valid_SymbolTable

bool SuifValidater::is_valid_SymbolTable(SymbolTable* symtab)
{
  if (symtab == NULL)
    SUIF_THROW(SuifException(String("Cannot validate a NULL SymbolTable.")));
  bool ok_stat = true;
  {for (Iter<SymbolTable::lookup_table_pair> it =
	 symtab->get_lookup_table_iterator();
       it.is_valid();
       it.next()) {
    if (!symtab->has_symbol_table_object_member(it.current().second)) {
      ok_stat = false;
      add_error(to_id_string(symtab) + " has a lookup pair <" +
		it.current().first + ", " + to_id_string(it.current().second) +
		"> with dangling object.");
    }
  }}

  {for (Iter<SymbolTableObject*> it =
	 symtab->get_symbol_table_object_iterator();
       it.is_valid();
       it.next()) {
    SymbolTableObject *sobj = it.current();
    if ((sobj->get_name().length() > 0) &&
	!is_in_lookup_list(it.current(), symtab)) {
      ok_stat = false;
      add_error(to_id_string(symtab) + " has " +
		to_id_string(it.current()) + " not in lookup list.");
    }
  }}
  return ok_stat;
}
开发者ID:jrk,项目名称:suif2,代码行数:31,代码来源:suif_validater.cpp

示例3: HasLoop

bool TransformSystemsToModules::HasLoop()
{
  assert(procDef != NULL) ;
  Iter<CForStatement> forIter = 
    object_iterator<CForStatement>(procDef->get_body()) ;
  return forIter.is_valid() ;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:7,代码来源:transform_systems_to_modules.cpp

示例4: CollectInitializations

void ConstantArrayPropagationPass::CollectInitializations()
{
  if (!initializations.empty())
  {
    initializations.clear() ;
  }

  DefinitionBlock* procDefBlock = procDef->get_definition_block() ;
  assert(procDefBlock != NULL) ;
  Iter<VariableDefinition*> varDefIter = 
    procDefBlock->get_variable_definition_iterator() ;
  while (varDefIter.is_valid())
  {    
    VariableDefinition* varDef = varDefIter.current() ;
    assert(varDef != NULL) ;

    VariableSymbol* varSym = varDef->get_variable_symbol() ;
    ValueBlock* valBlock = varDef->get_initialization() ;
    assert(varSym != NULL) ;
    assert(valBlock != NULL) ;

    if (ValidSymbol(varSym)) 
    {
      initializations[varSym] = valBlock ;
      varSym->append_annote(create_brick_annote(theEnv, "ConstPropArray")) ;
    }

    varDefIter.next() ;
  }
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:30,代码来源:constantArrayPropagationPass.cpp

示例5: dismantle_multi_way_branch_statement

Statement* multi_way_branch_statement_walker::dismantle_multi_way_branch_statement(MultiWayBranchStatement *the_case){
    StatementList *replacement = create_statement_list(the_case->get_suif_env());

    Expression *operand = the_case->get_decision_operand ();
    remove_suif_object(operand);

    DataType *type = operand->get_result_type();

    CodeLabelSymbol *default_lab =  the_case->get_default_target();
    the_case->set_default_target(0);
    Iter<MultiWayBranchStatement::case_pair > iter = the_case->get_case_iterator();
    while (iter.is_valid()) {
	MultiWayBranchStatement::case_pair pair = iter.current();
	IInteger value = pair.first;
	CodeLabelSymbol *lab = pair.second;
	IntConstant *exp = create_int_constant(the_case->get_suif_env(),type, value);
//	Expression *exp = create_load_constant_expression(get_env(),type,iconst);
	TypeBuilder *type_builder = (TypeBuilder *)
          the_case->get_suif_env()->get_object_factory(TypeBuilder::get_class_name());
	Expression *compare =  
	  create_binary_expression(the_case->get_suif_env(),type_builder->get_boolean_type(),
				   k_is_equal_to,
				   deep_suif_clone(operand),
				   exp);
	replacement->append_statement(create_branch_statement(the_case->get_suif_env(),compare,lab));
	iter.next();
	}
    delete operand;
    replacement->append_statement(create_jump_statement(the_case->get_suif_env(),default_lab));
    the_case->get_parent()->replace(the_case,replacement);
    return replacement;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:32,代码来源:statement_dismantlers.cpp

示例6:

void NormalizeProcedureReturns::
do_procedure_definition( ProcedureDefinition *pd ) {
  ProcedureSymbol *ps = pd->get_procedure_symbol();
  if (!ps) return;
  ProcedureType *t = to<ProcedureType>(ps->get_type());
  if (!is_kind_of<CProcedureType>(t))
    return;
  CProcedureType *ct = to<CProcedureType>(t);
  DataType *result = ct->get_result_type();
  bool is_void = is_kind_of<VoidType>(result);

  for (Iter<ReturnStatement> iter = object_iterator<ReturnStatement>(pd);
       iter.is_valid(); iter.next()) {
    ReturnStatement *ret = &iter.current();
    if (ret == NULL) continue;
    
    Expression *ret_expr = ret->get_return_value();

    if (is_void) {
      if (ret_expr != NULL) {
	// Should not be here
	trash_it(remove_suif_object(ret_expr));
      }
    } else {
      if (ret_expr == NULL) {
	// build a NULL expression to match the DataType.
	Expression *x = build_empty_expression(result);
	ret->set_return_value(x);
      }
    }
  }
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:32,代码来源:function_dismantlers.cpp

示例7: get_statement_block_btw_labels

StatementList* get_statement_block_btw_labels(ProcedureDefinition *proc_def, CodeLabelSymbol *start_label_sym,
        CodeLabelSymbol *end_label_sym) {

    StatementList *stmt_block = create_statement_list(proc_def->get_suif_env());

    for(Iter<LabelLocationStatement> iter = object_iterator<LabelLocationStatement>(proc_def->get_body());
            iter.is_valid(); iter.next()) {

        LabelLocationStatement *start_label_loc_stmt = &iter.current();

        if(start_label_loc_stmt->get_defined_label() == start_label_sym) {

            Statement *next_stmt = get_next_statement(start_label_loc_stmt);
            while(next_stmt != NULL) {
                if(is_a<LabelLocationStatement>(next_stmt)) {
                    if((to<LabelLocationStatement>(next_stmt))->get_defined_label() == end_label_sym)
                        return stmt_block;
                } else if(is_a<JumpStatement>(next_stmt)) {
                    if((to<JumpStatement>(next_stmt))->get_target() == end_label_sym)
                        return stmt_block;
                }
                stmt_block->append_statement(to<Statement>(deep_suif_clone(next_stmt)));
                next_stmt = get_next_statement(next_stmt);
            }
            delete stmt_block;
            return NULL;
        }
    }
    delete stmt_block;
    return NULL;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:31,代码来源:switch_case_to_if_stmts_pass.cpp

示例8: handle_static_expression

//
//  Here are the visit methods
//  for the c-like printing
//
// All of these handle_
// will set the string in the state before returning.
static
String handle_static_expression(CPrintStyleModule *state,
				const SuifObject *obj)
{
  Expression *expr = to<Expression>(obj);

  // Use the iterator over source ops and
  // get the classname
  String opname = expr->getClassName();
  String return_str = String("?") + opname + "(";
  bool needs_comma = false;
  for (Iter<Expression *> iter = expr->get_source_op_iterator();
       iter.is_valid();
       iter.next()) {
    Expression *opn = iter.current();
    if (needs_comma) {
      return_str += ",";
    } else {
      needs_comma = true;
    }
    String op = state->print_to_string(opn);
    return_str += op;
  }
  return_str += ")";
  return(return_str);
}
开发者ID:jrk,项目名称:suif2,代码行数:32,代码来源:cprint_style.cpp

示例9: handle_static_call_statement

static
String handle_static_call_statement(CPrintStyleModule *state,
				    const SuifObject *obj)
{
  CallStatement *expr =
    to<CallStatement>(obj);
  String addr = state->print_to_string(expr->get_callee_address());
  String return_str;
  if (expr->get_destination() != NULL) {
    return_str += state->print_to_string(expr->get_destination());
    return_str += " = ";
  }

  return_str += String("(") + addr + ")(";
  bool needs_comma = false;
  for (Iter<Expression *> iter = expr->get_argument_iterator();
       iter.is_valid();
       iter.next()) {
    Expression *opn = iter.current();
    if (needs_comma) {
      return_str += ",";
    } else {
      needs_comma = true;
    }
    String op = state->print_to_string(opn);
    return_str += op;
  }
  return_str += ")";
  return(return_str);
}
开发者ID:jrk,项目名称:suif2,代码行数:30,代码来源:cprint_style.cpp

示例10: get_object_location

ObjectLocation LocationModule::get_object_location(SuifObject *obj) {
  ObjectLocation loc;
  if (!obj) {
    return(loc);
  }
  
  // part of a stmt list: walk from the beginning of the list
  // down until we find a line #
  const SuifObject* child = NULL;
  const SuifObject* parent = obj;
  for (; parent != NULL; child = parent, parent = parent->get_parent()) {

    loc = read_line_number(obj);
    if (loc.get_is_known()) return(loc);

    if(is_kind_of<StatementList>(parent)){
      StatementList* the_list = to<StatementList>(parent);
      for(Iter<Statement*> iter = the_list->get_statement_iterator();
	  iter.is_valid() && iter.current() != child; 
	  iter.next())
	{
	  loc = read_line_number(iter.current());
	  // for the original object, if it is a StatementList
	  // return the first mark found in it.
	  if (child == NULL && loc.get_is_known())
	    return(loc);
	}
    }
    if (loc.get_is_known())
      return loc;
  }
  // Now try to just get the input file
  return(get_object_filename(obj));
  //  return(loc);
};
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:35,代码来源:location_modules.cpp

示例11: solve_li_statement_list_stmt

void solve_li_statement_list_stmt(Statement *s){
     	StatementList *stmt_list = to<StatementList>(s);

     	for (Iter<Statement*> iter = stmt_list->get_child_statement_iterator();
	     iter.is_valid(); iter.next())
	     solve_li_statement(iter.current());

}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:8,代码来源:loop_info_pass.cpp

示例12: if

/* Useful for printing annotations as comments.  Expects that
 * the annotation is a BrickAnnote. */
  void
Printer::print_annote(Annote *annote)
{
  start_comment();

  IdString name = annote->get_name();

  if (name != k_comment)
    fprintf(out, "[%s", name.chars());

  if (is_kind_of<BrickAnnote>(annote)) {
    BrickAnnote *an = (BrickAnnote *)(annote);
    char *separator = ": ";

    for (Iter<SuifBrick*> iter = an->get_brick_iterator();
        iter.is_valid(); iter.next())
    {
      fputs(separator, out);
      separator = ", ";

      SuifBrick *brick = iter.current();
      if (is_a<IntegerBrick>(brick)) {
        Integer i = ((IntegerBrick*)iter.current())->get_value();
        if (i.is_c_string_int())
          fputs(i.chars(), out);
        else
          fprintf(out, "%ld", i.c_long());
      }
      else if (is_a<StringBrick>(brick)) {
        putc('"', out);
        for (const char *p =
            ((StringBrick*)iter.current())->get_value().c_str();
            *p != '\0'; ++p)
        {
          if (*p == '"' || *p == '\\')
            putc('\\', out);
          putc(*p, out);
        }
        putc('"', out);
      }
      else {
        claim(is_a<SuifObjectBrick>(brick));
        SuifObject *so = ((SuifObjectBrick*)brick)->get_object();
        if (is_kind_of<Type>(so))
          fprint(out, (TypeId)so);
        else {
          const char *kind = so ? get_class_name(so) : "NULL";
          fprintf(out, "<<<%s object>>>", kind);
        }
      }
    }
  } else {
    claim(is_kind_of<GeneralAnnote>(annote), "Unexpected kind of Annote");
  }
  if (name != k_comment)
    fputs("]", out);
  fputs("\n", out);
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:60,代码来源:printer.cpp

示例13: do_procedure_definition

void ConstQualedVarPropagationPass::do_procedure_definition(ProcedureDefinition* proc_def)
{
  OutputInformation("Constant qualified variable propagation pass begins");

  suif_map<VariableSymbol*, ValueBlock*> temp_const_defs;
    if (proc_def){
        DefinitionBlock *proc_def_block = proc_def->get_definition_block();
        for(Iter<VariableDefinition*> iter = proc_def_block->get_variable_definition_iterator();
            iter.is_valid(); iter.next()){
            VariableDefinition *var_def = iter.current();
            VariableSymbol *var_sym = var_def->get_variable_symbol();
            QualifiedType *qualed_var_type = var_sym->get_type();
            if(is_a<IntegerType>(qualed_var_type->get_base_type())){
               bool found = 0;
               for(Iter<LString> iter2 = qualed_var_type->get_qualification_iterator();
                   iter2.is_valid(); iter2.next())
                   if(iter2.current() == LString("const"))
                      found = 1;
               if(found){
                  temp_const_defs.enter_value(var_sym, var_def->get_initialization());
               }
            }
        }
        for(Iter<StoreVariableStatement> iter = object_iterator<StoreVariableStatement>(proc_def->get_body());
            iter.is_valid(); iter.next()){
            StoreVariableStatement *store_var_stmt = &iter.current();
            Expression *store_var_value = store_var_stmt->get_value();
            if(!is_a<IntConstant>(store_var_value))
               continue;
            VariableSymbol *store_var_destination = store_var_stmt->get_destination();
            if(!is_a<IntegerType>(store_var_destination->get_type()->get_base_type()))  
               continue;
            suif_map<VariableSymbol*,ValueBlock*>::iterator iter2 =
                        temp_const_defs.find(to<LoadVariableExpression>(store_var_value)->get_source());
            if(iter2 != temp_const_defs.end())
               const_qualified_scalars.enter_value(store_var_destination, (*iter2).second);
        }
        cqvp_load_variable_expression_walker walker(get_suif_env());
        proc_def->walk(walker);
    }
  OutputInformation("Constant qualified variable propagation pass ends");
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:42,代码来源:const_qld_var_propagation_pass.cpp

示例14: get_src_var

unsigned SemanticHelper::get_src_var(const ExecutionObject* exe,
				     suif_vector<VariableSymbol*>* var_vect)
{
  unsigned cnt = 0;
  for (Iter<VariableSymbol*> iter = exe->get_source_var_iterator();
       iter.is_valid();
       iter.next()) {
    cnt++;
    if (var_vect != 0)
      var_vect->push_back(iter.current());
  }
  for (Iter<Expression*> siter = exe->get_source_op_iterator();
       siter.is_valid();
       siter.next()) {
    Expression* exp = siter.current();
    if (exp == 0) continue;
    cnt += get_src_var(exp, var_vect);
  }
  return cnt;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:20,代码来源:semantic_helper.cpp

示例15: find_field

/** find the field with the name.
  */
static FieldSymbol* find_field(GroupType* gtype, LString field_name)
{
  for (Iter<SymbolTableObject*> iter =
	 gtype->get_group_symbol_table()->get_symbol_table_object_iterator();
       iter.is_valid();
       iter.next()) {
    if (iter.current()->get_name() != field_name) continue;
    return to<FieldSymbol>(iter.current());
  }
  return 0;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:13,代码来源:node_builder.cpp


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