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


C++ DenseMap::insert方法代码示例

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


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

示例1: OS

llvm::Function *CGObjCJit::GenerateMethod(const ObjCMethodDecl *OMD,
                                          const ObjCContainerDecl *CD) {

  assert(CD && "Missing container decl in GetNameForMethod");

  llvm::SmallString<256> Name;
  llvm::raw_svector_ostream OS(Name);

  OS << '\01' << (OMD->isInstanceMethod() ? '-' : '+')
     << '[' << CD->getName();
  if (const ObjCCategoryImplDecl *CID =
        dyn_cast<ObjCCategoryImplDecl>(OMD->getDeclContext())) {
    OS << '(' << CID << ')';
  }
  OS << ' ' << OMD->getSelector().getAsString() << ']';

  CodeGenTypes &Types = CGM.getTypes();
  llvm::FunctionType *MethodTy =
    Types.GetFunctionType(Types.arrangeObjCMethodDeclaration(OMD));
  llvm::Function *Method =
    llvm::Function::Create(MethodTy,
                           llvm::GlobalValue::InternalLinkage,
                           Name.str(),
                           &CGM.getModule());
  MethodDefinitions.insert(std::make_pair(OMD, Method));

  return Method;
}
开发者ID:eerolanguage,项目名称:clang-interpreter-runtime,代码行数:28,代码来源:CGObjCJit.cpp

示例2: isDeclCandidate

    bool isDeclCandidate(FunctionDecl * FDecl) {
      if (m_NonNullArgIndexs.count(FDecl))
        return true;

      if (llvm::isa<CXXRecordDecl>(FDecl))
        return true;

      std::bitset<32> ArgIndexs;
      for (specific_attr_iterator<NonNullAttr>
             I = FDecl->specific_attr_begin<NonNullAttr>(),
             E = FDecl->specific_attr_end<NonNullAttr>(); I != E; ++I) {

        NonNullAttr *NonNull = *I;
        for (NonNullAttr::args_iterator i = NonNull->args_begin(),
               e = NonNull->args_end(); i != e; ++i) {
          ArgIndexs.set(*i);
        }
      }

      if (ArgIndexs.any()) {
        m_NonNullArgIndexs.insert(std::make_pair(FDecl, ArgIndexs));
        return true;
      }
      return false;
    }
开发者ID:FableQuentin,项目名称:root,代码行数:25,代码来源:NullDerefProtectionTransformer.cpp

示例3: new

  ModuleDecl *loadModule(SourceLoc importLoc,
                         ArrayRef<std::pair<Identifier, SourceLoc>> path) {
    // FIXME: Implement submodule support!
    Identifier name = path[0].first;

    auto it = ModuleWrappers.find(name);
    if (it != ModuleWrappers.end())
      return it->second->getParentModule();

    auto *decl = ModuleDecl::create(name, SwiftContext);
    // Silence error messages about testably importing a Clang module.
    decl->setTestingEnabled();
    decl->setHasResolvedImports();
    auto wrapperUnit = new (SwiftContext) DWARFModuleUnit(*decl);
    ModuleWrappers.insert({name, wrapperUnit});
    decl->addFile(*wrapperUnit);

    // Force load adapter modules for all imported modules.
    decl->forAllVisibleModules({}, [](ModuleDecl::ImportedModule import) {});

    return decl;
  }
开发者ID:DevAndArtist,项目名称:swift,代码行数:22,代码来源:DWARFImporter.cpp

示例4: allocateTemporaries

/// Returns true on success.
bool PartialApplyCombiner::allocateTemporaries() {
    // Copy the original arguments of the partial_apply into
    // newly created temporaries and use these temporaries instead of
    // the original arguments afterwards.
    // This is done to "extend" the life-time of original partial_apply
    // arguments, as they may be destroyed/deallocated before the last
    // use by one of the apply instructions.
    // TODO:
    // Copy arguments of the partial_apply into new temporaries
    // only if the lifetime of arguments ends before their uses
    // by apply instructions.
    bool needsReleases = false;
    CanSILFunctionType PAITy =
        dyn_cast<SILFunctionType>(PAI->getCallee()->getType().getSwiftType());

    // Emit a destroy value for each captured closure argument.
    ArrayRef<SILParameterInfo> Params = PAITy->getParameters();
    auto Args = PAI->getArguments();
    unsigned Delta = Params.size() - Args.size();

    llvm::SmallVector<std::pair<SILValue, unsigned>, 8> ArgsToHandle;
    for (unsigned AI = 0, AE = Args.size(); AI != AE; ++AI) {
        SILValue Arg = Args[AI];
        SILParameterInfo Param = Params[AI + Delta];
        if (Param.isIndirectMutating())
            continue;
        // Create a temporary and copy the argument into it, if:
        // - the argument stems from an alloc_stack
        // - the argument is consumed by the callee and is indirect
        //   (e.g. it is an @in argument)
        if (isa<AllocStackInst>(Arg) ||
                (Param.isConsumed() && Param.isIndirect())) {
            // If the temporary is non-trivial, we need to release it later.
            if (!Arg->getType().isTrivial(PAI->getModule()))
                needsReleases = true;
            ArgsToHandle.push_back(std::make_pair(Arg, AI));
        }
    }

    if (needsReleases) {
        // Compute the set of endpoints, which will be used to insert releases of
        // temporaries. This may fail if the frontier is located on a critical edge
        // which we may not split (no CFG changes in SILCombine).
        ValueLifetimeAnalysis VLA(PAI);
        if (!VLA.computeFrontier(PAFrontier, ValueLifetimeAnalysis::DontModifyCFG))
            return false;
    }

    for (auto ArgWithIdx : ArgsToHandle) {
        SILValue Arg = ArgWithIdx.first;
        Builder.setInsertionPoint(PAI->getFunction()->begin()->begin());
        // Create a new temporary at the beginning of a function.
        auto *Tmp = Builder.createAllocStack(PAI->getLoc(), Arg->getType(),
        {/*Constant*/ true, ArgWithIdx.second});
        Builder.setInsertionPoint(PAI);
        // Copy argument into this temporary.
        Builder.createCopyAddr(PAI->getLoc(), Arg, Tmp,
                               IsTake_t::IsNotTake,
                               IsInitialization_t::IsInitialization);

        Tmps.push_back(Tmp);
        ArgToTmp.insert(std::make_pair(Arg, Tmp));
    }
    return true;
}
开发者ID:seabaylea,项目名称:swift,代码行数:66,代码来源:SILCombinerApplyVisitors.cpp

示例5: insertAsUnhandled

 bool insertAsUnhandled(SILBasicBlock *Pred) {
   return Block2StackDepth.insert({Pred, -2}).second;
 }
开发者ID:KoKumagai,项目名称:swift,代码行数:3,代码来源:StackPromotion.cpp


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