Exemplo n.º 1
0
void FunctionContainer::getFunctionsFlattened(
  const StringToFunctionScopePtrVecMap *redec,
  FunctionScopePtrVec &funcs,
  bool excludePseudoMains /* = false */) const {
  for (StringToFunctionScopePtrMap::const_iterator it = m_functions.begin();
       it != m_functions.end(); ++it) {
    FunctionScopePtr func = it->second;
    if (!excludePseudoMains || !func->inPseudoMain()) {
      if (func->isLocalRedeclaring()) {
        const FunctionScopePtrVec &r = redec->find(it->first)->second;
        funcs.insert(funcs.end(), r.begin(), r.end());
      } else {
        funcs.push_back(func);
      }
    }
  }
}
Exemplo n.º 2
0
void FunctionContainer::countReturnTypes(
  std::map<std::string, int> &counts,
  const StringToFunctionScopePtrVecMap *redec) {
  for (StringToFunctionScopePtrMap::const_iterator iter =
         m_functions.begin(); iter != m_functions.end(); ++iter) {
    FunctionScopePtr f = iter->second;
    if (f->isLocalRedeclaring()) {
      always_assert(redec);
      for (FunctionScopePtr f: redec->find(iter->first)->second) {
        TypePtr type = f->getReturnType();
        if (type) {
          type->count(counts);
        }
      }
    } else {
      TypePtr type = f->getReturnType();
      if (type) {
        type->count(counts);
      }
    }
  }
}