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


C++ AnyFunctionRef::getAsDeclContext方法代码示例

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


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

示例1: emitProlog

void SILGenFunction::emitProlog(AnyFunctionRef TheClosure,
                                ArrayRef<ParameterList*> paramPatterns,
                                Type resultType) {
  unsigned ArgNo =
    emitProlog(paramPatterns, resultType, TheClosure.getAsDeclContext());

  // Emit the capture argument variables. These are placed last because they
  // become the first curry level of the SIL function.
  auto captureInfo = SGM.Types.getLoweredLocalCaptures(TheClosure);
  for (auto capture : captureInfo.getCaptures()) {
    if (capture.isDynamicSelfMetadata()) {
      auto selfMetatype = MetatypeType::get(
          captureInfo.getDynamicSelfType()->getSelfType(),
          MetatypeRepresentation::Thick)
              ->getCanonicalType();
      SILType ty = SILType::getPrimitiveObjectType(selfMetatype);
      SILValue val = new (SGM.M) SILArgument(F.begin(), ty);
      (void) val;

      return;
    }

    emitCaptureArguments(*this, capture, ++ArgNo);
  }
}
开发者ID:dgrove-oss,项目名称:swift,代码行数:25,代码来源:SILGenProlog.cpp

示例2: emitProlog

void SILGenFunction::emitProlog(AnyFunctionRef TheClosure,
                                ArrayRef<ParameterList*> paramPatterns,
                                Type resultType) {
  unsigned ArgNo =
    emitProlog(paramPatterns, resultType, TheClosure.getAsDeclContext());

  // Emit the capture argument variables. These are placed last because they
  // become the first curry level of the SIL function.
  auto captureInfo = SGM.Types.getLoweredLocalCaptures(TheClosure);
  for (auto capture : captureInfo.getCaptures())
    emitCaptureArguments(*this, capture, ++ArgNo);
}
开发者ID:6008,项目名称:swift,代码行数:12,代码来源:SILGenProlog.cpp

示例3: emitProlog

void SILGenFunction::emitProlog(AnyFunctionRef TheClosure,
                                ArrayRef<ParameterList*> paramPatterns,
                                Type resultType, bool throws) {
  uint16_t ArgNo = emitProlog(paramPatterns, resultType,
                              TheClosure.getAsDeclContext(), throws);

  // Emit the capture argument variables. These are placed last because they
  // become the first curry level of the SIL function.
  auto captureInfo = SGM.Types.getLoweredLocalCaptures(TheClosure);
  for (auto capture : captureInfo.getCaptures()) {
    if (capture.isDynamicSelfMetadata()) {
      auto selfMetatype = MetatypeType::get(
        captureInfo.getDynamicSelfType());
      SILType ty = getLoweredType(selfMetatype);
      SILValue val = F.begin()->createFunctionArgument(ty);
      (void) val;

      return;
    }

    emitCaptureArguments(*this, TheClosure, capture, ++ArgNo);
  }
}
开发者ID:ahti,项目名称:swift,代码行数:23,代码来源:SILGenProlog.cpp

示例4: emitProlog

void SILGenFunction::emitProlog(AnyFunctionRef TheClosure,
                                ParameterList *paramList,
                                ParamDecl *selfParam,
                                Type resultType, bool throws) {
  uint16_t ArgNo = emitProlog(paramList, selfParam, resultType,
                              TheClosure.getAsDeclContext(), throws);
  
  // Emit an unreachable instruction if a parameter type is
  // uninhabited
  if (paramList) {
    for (auto *param : *paramList) {
      if (param->getType()->isStructurallyUninhabited()) {
        SILLocation unreachableLoc(param);
        unreachableLoc.markAsPrologue();
        B.createUnreachable(unreachableLoc);
        break;
      }
    }
  }

  // Emit the capture argument variables. These are placed last because they
  // become the first curry level of the SIL function.
  auto captureInfo = SGM.Types.getLoweredLocalCaptures(TheClosure);
  for (auto capture : captureInfo.getCaptures()) {
    if (capture.isDynamicSelfMetadata()) {
      auto selfMetatype = MetatypeType::get(
        captureInfo.getDynamicSelfType());
      SILType ty = getLoweredType(selfMetatype);
      SILValue val = F.begin()->createFunctionArgument(ty);
      (void) val;

      return;
    }

    emitCaptureArguments(*this, TheClosure, capture, ++ArgNo);
  }
}
开发者ID:benlangmuir,项目名称:swift,代码行数:37,代码来源:SILGenProlog.cpp


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