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


C++ SymbolMap类代码示例

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


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

示例1: inlineCall

//
// inlines the function called by 'call' at that call site
//
static void
inlineCall(FnSymbol* fn, CallExpr* call, Vec<FnSymbol*>& canRemoveRefTempSet) {
  INT_ASSERT(call->isResolved() == fn);
  SET_LINENO(call);

  Expr* stmt = call->getStmtExpr();

  //
  // calculate a map from actual symbols to formal symbols
  //
  SymbolMap map;
  for_formals_actuals(formal, actual, call) {
    SymExpr* se = toSymExpr(actual);
    INT_ASSERT(se);
    if ((formal->intent & INTENT_REF) && canRemoveRefTempSet.set_in(fn)) {
      if (se->var->hasFlag(FLAG_REF_TEMP)) {
        if (CallExpr* move = findRefTempInit(se)) {
          SymExpr* origSym = NULL;
          if (CallExpr* addrOf = toCallExpr(move->get(2))) {
            INT_ASSERT(addrOf->isPrimitive(PRIM_ADDR_OF));
            origSym = toSymExpr(addrOf->get(1));
          } else {
            origSym = toSymExpr(move->get(2));
          }
          INT_ASSERT(origSym);
          map.put(formal, origSym->var);
          se->var->defPoint->remove();
          move->remove();
          continue;
        }
      }
    }
    map.put(formal, se->var);
  }
开发者ID:NataliaBondarevska,项目名称:chapel,代码行数:37,代码来源:inlineFunctions.cpp

示例2: findCursorInfo

SymbolMap::const_iterator findCursorInfo(const SymbolMap &map, const Location &location, const String &context,
                                         const SymbolMap *errors, bool *foundInErrors)
{
    if (foundInErrors)
        *foundInErrors = false;
    if (map.isEmpty() && !errors)
        return map.end();
    if (errors) {
        SymbolMap::const_iterator ret = findCursorInfo(map, location, context, false);
        if (ret != map.end()) {
            return ret;
        }
        ret = findCursorInfo(*errors, location, context, false);
        if (ret != errors->end()) {
            if (foundInErrors)
                *foundInErrors = true;
            return ret;
        }
        // ret = findCursorInfo(*errors, location, context, true);
        // if (ret != errors->end()) {
        //     if (foundInErrors)
        //         *foundInErrors = true;
        //     return ret;
        // }
        // ret = findCursorInfo(map, location, context, true);
        // if (ret != map.end()) {
        //     return ret;
        // }

        return map.end();
    } else {
        const SymbolMap::const_iterator ret = findCursorInfo(map, location, context, true);
        return ret;
    }
}
开发者ID:jsyjr,项目名称:rtags,代码行数:35,代码来源:RTagsClang.cpp

示例3: trial

  void trial( SymbolList & testSet,
	      SymbolList & notCirc,
	      SymbolMap  & symbolMap
	    )
  {
    bool bDone = false;

    while (!bDone)
    {
      bDone = true;

      SymbolList::iterator item = testSet.begin();
      SymbolList::iterator last = testSet.end();
      
      while (item != last)
      {
        SymbolList::iterator thisItem = item++;
        const Symbol sym = *thisItem;

        bool bIsReferedTo = symbolMap.isReferredTo( sym );
        bool bRefersTo    = symbolMap.refersTo    ( sym );

        if (!( bIsReferedTo && bRefersTo) )
        {
          bDone = false;

          symbolMap.remove( sym );

          testSet.remove( sym );

          notCirc.push_back( sym );
        }
      }
    }
  }
开发者ID:madGambol,项目名称:OMDT,代码行数:35,代码来源:circAnalysis.cpp

示例4: PutSymbol

void ObjIeeeAscii::PutSymbol(SymbolMap &map, int index, ObjSymbol *sym)
{
    if (map.size() <= index)
    {
        map.resize(index > 100 ? index*2 : 200);
    }
    map[index] = sym;
}
开发者ID:jossk,项目名称:OrangeC,代码行数:8,代码来源:ObjIeeeAsciiRead.cpp

示例5: getSymbol

	std::string getSymbol( const std::string &varName ) {
		SymbolMap::iterator sbmItr = _symbolMap.find( varName );
		if ( sbmItr == _symbolMap.end() ) {
			SpecialSymbolMap::iterator ssmItr = _specialSymbolMap.find( varName );
			return ssmItr == _specialSymbolMap.end() ? varName : ssmItr->second;
		}
		return sbmItr->second.back();
	}
开发者ID:pombreda,项目名称:metamorphosys-desktop,代码行数:8,代码来源:ScopeSymbolTable.hpp

示例6: copy

SymbolMap CursorInfo::virtuals(const Location &loc, const SymbolMap &map) const
{
    SymbolMap ret;
    ret[loc] = copy();
    const SymbolMap s = (kind == CXCursor_CXXMethod ? allReferences(loc, map) : targetInfos(map));
    for (auto it = s.begin(); it != s.end(); ++it) {
        if (it->second->kind == kind)
            ret[it->first] = it->second;
    }
    return ret;
}
开发者ID:bobmoretti,项目名称:rtags,代码行数:11,代码来源:CursorInfo.cpp

示例7: allReferences

SymbolMap CursorInfo::virtuals(const Location &loc, const SymbolMap &map, const SymbolMap *errors) const
{
    SymbolMap ret;
    ret[loc] = *this;
    const SymbolMap s = (kind == CXCursor_CXXMethod ? allReferences(loc, map, errors) : targetInfos(map, errors));
    for (SymbolMap::const_iterator it = s.begin(); it != s.end(); ++it) {
        if (it->second.kind == kind)
            ret[it->first] = it->second;
    }
    return ret;
}
开发者ID:xinsuiyuer,项目名称:rtags,代码行数:11,代码来源:CursorInfo.cpp

示例8: dirtySymbols

void dirtySymbols(SymbolMap &map, const Set<uint32_t> &dirty)
{
    SymbolMap::iterator it = map.begin();
    while (it != map.end()) {
        if (dirty.contains(it->first.fileId())) {
            map.erase(it++);
        } else {
            it->second->dirty(dirty);
            ++it;
        }
    }
}
开发者ID:graydon,项目名称:rtags,代码行数:12,代码来源:RTags.cpp

示例9: expand_wavefront

//==================================
// Update CodeTree
//==================================
void SpineDecoder::expand_wavefront(vector<int> sym_spine){

	/* 变量的定义和初始化是按照变量的用途分类的 */

	int edge_metric = 0;
	int distance = 0;

	RNG rng;
	SymbolMap mapper;
	uint8_t node_symbol = 0;

	vector<CodeTreeNode> wavefront = this->wavefront;
	vector<CodeTreeNode> new_wavefront;

	/* 数组 wavefront 中的每一个元素对应 spine_t 的一个节点 */
	vector<CodeTreeNode>::iterator iwave = wavefront.begin();

	/* 创建树的过程是一层一层的创建,使用 vector 添加或删除节点时,实现起来比较方便 */
	while(iwave != wavefront.end()){
		for(int edge=0; edge!=(1<<(this->k)); ++edge){//edge 也就是 mt,这个循环用来遍历可能出现的 k-bit m.
			CodeTreeNode new_node;

			/* 1. update spine_value */
			new_node.spine_value = hash_func(iwave->spine_value, edge);
			rng = RNG(new_node.spine_value);
			for(int i=0; i!=this->L; ++i){
				node_symbol = mapper.map_func(rng.next());
				distance = sym_spine[i] - node_symbol;
				edge_metric = distance * distance;
			}//end for

			/* 2.update path_metric */
			new_node.path_metric = iwave->path_metric + edge_metric;

			/* 3.update path */
			new_node.path = iwave->path;
			new_node.path.push_back(edge);

			/* Finaly, update wavefront */
			new_wavefront.push_back(new_node);

		}//end for
		++iwave;
	}//end while
	this->wavefront = new_wavefront;

	if(!wavefront.empty())
		wavefront.clear();

	if(!new_wavefront.empty())
		new_wavefront.clear();
}
开发者ID:baobao7766,项目名称:wireless3,代码行数:55,代码来源:SpineDecoder.cpp

示例10: joinCursors

static inline void joinCursors(SymbolMap &symbols, const Set<Location> &locations)
{
    for (Set<Location>::const_iterator it = locations.begin(); it != locations.end(); ++it) {
        SymbolMap::iterator c = symbols.find(*it);
        if (c != symbols.end()) {
            CursorInfo &cursorInfo = c->second;
            for (Set<Location>::const_iterator innerIt = locations.begin(); innerIt != locations.end(); ++innerIt) {
                if (innerIt != it)
                    cursorInfo.targets.insert(*innerIt);
            }
            // ### this is filthy, we could likely think of something better
        }
    }
}
开发者ID:jbulow,项目名称:rtags,代码行数:14,代码来源:Project.cpp

示例11: markOuterVarsWithIntents

// Mark the variables listed in 'with' clauses, if any, with tiMark markers.
// Same as markOuterVarsWithIntents() in implementForallIntents.cpp,
// except uses byrefVars instead of forallIntents.
static void markOuterVarsWithIntents(CallExpr* byrefVars, SymbolMap& uses) {
  if (!byrefVars) return;
  Symbol* marker = NULL;

  // Keep in sync with setupForallIntents() - the actuals alternate:
  //  (tiMark arg | reduce opExpr), task-intent variable [, repeat]
  for_actuals(actual, byrefVars) {
    SymExpr* se = toSymExpr(actual);
    INT_ASSERT(se); // comes as an UnresolvedSymExpr from the parser,
                    // should have been resolved in ScopeResolve
                    // or it is a SymExpr over a tiMark ArgSymbol
                    //                 or over chpl__reduceGlob
    Symbol* var = se->symbol();
    if (marker) {
      SymbolMapElem* elem = uses.get_record(var);
      if (elem) {
        elem->value = marker;
      } else {
        if (isVarSymbol(marker)) {
          // this is a globalOp created in setupOneReduceIntent()
          INT_ASSERT(!strcmp(marker->name, "chpl__reduceGlob"));
          USR_WARN(byrefVars, "the variable '%s' is given a reduce intent and not mentioned in the loop body - it will have the unit value after the loop", var->name);
        }
      }
      marker = NULL;
    } else {
      marker = var;
      INT_ASSERT(marker);  // otherwise the alternation logic will not work
    }
  }
开发者ID:rlugojr,项目名称:chapel,代码行数:33,代码来源:createTaskFunctions.cpp

示例12: inlineCall

//
// inlines the function called by 'call' at that call site
//
static void
inlineCall(FnSymbol* fn, CallExpr* call) {
  INT_ASSERT(call->isResolved() == fn);
  SET_LINENO(call);

  Expr* stmt = call->getStmtExpr();

  //
  // calculate a map from actual symbols to formal symbols
  //
  SymbolMap map;
  for_formals_actuals(formal, actual, call) {
    SymExpr* se = toSymExpr(actual);
    INT_ASSERT(se);
    map.put(formal, se->var);
  }
开发者ID:aroonsharma1,项目名称:Chapel_Masters_Work,代码行数:19,代码来源:inlineFunctions.cpp

示例13: writeErrorSymbols

static inline void writeErrorSymbols(const SymbolMap &symbols, ErrorSymbolMap &errorSymbols, const Map<uint32_t, int> &errors)
{
    for (Map<uint32_t, int>::const_iterator it = errors.begin(); it != errors.end(); ++it) {
        if (it->second) {
            SymbolMap &symbolsForFile = errorSymbols[it->first];
            if (symbolsForFile.isEmpty()) {
                const Location loc(it->first, 0);
                SymbolMap::const_iterator sit = symbols.lower_bound(loc);
                while (sit != symbols.end() && sit->first.fileId() == it->first) {
                    symbolsForFile[sit->first] = sit->second;
                    ++sit;
                }
            }
        } else {
            errorSymbols.remove(it->first);
        }
    }
}
开发者ID:hapsunday,项目名称:rtags,代码行数:18,代码来源:Project.cpp

示例14: virtuals

SymbolMap CursorInfo::callers(const Location &loc, const SymbolMap &map, const SymbolMap *errors) const
{
    SymbolMap ret;
    const SymbolMap cursors = virtuals(loc, map, errors);
    for (SymbolMap::const_iterator c = cursors.begin(); c != cursors.end(); ++c) {
        for (Set<Location>::const_iterator it = c->second.references.begin(); it != c->second.references.end(); ++it) {
            const SymbolMap::const_iterator found = RTags::findCursorInfo(map, *it, String(), errors);
            if (found == map.end())
                continue;
            if (RTags::isReference(found->second.kind)) { // is this always right?
                ret[*it] = found->second;
            } else if (kind == CXCursor_Constructor && (found->second.kind == CXCursor_VarDecl || found->second.kind == CXCursor_FieldDecl)) {
                ret[*it] = found->second;
            }
        }
    }
    return ret;
}
开发者ID:xinsuiyuer,项目名称:rtags,代码行数:18,代码来源:CursorInfo.cpp

示例15: addDefAndMap

static void addDefAndMap(Expr* aInit, SymbolMap& map, ShadowVarSymbol* svar,
                         VarSymbol* currVar)
{
  if (currVar->type == dtNothing) {
    INT_ASSERT(currVar->firstSymExpr() == NULL);
    return;
  }
  aInit->insertBefore(new DefExpr(currVar));
  map.put(svar, currVar);
}
开发者ID:chapel-lang,项目名称:chapel,代码行数:10,代码来源:lowerForalls.cpp


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