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


C++ ProjectionPath::append方法代码示例

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


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

示例1: getFirstLevelLSLocations

void LSLocation::getFirstLevelLSLocations(LSLocationList &Locs,
                                          SILModule *Mod) {
  SILType Ty = getType();
  llvm::SmallVector<Projection, 8> Out;
  Projection::getFirstLevelAddrProjections(Ty, *Mod, Out);
  for (auto &X : Out) {
    ProjectionPath P;
    P.append(X);
    P.append(Path.getValue());
    Locs.push_back(LSLocation(Base, P));
  }
}
开发者ID:richlira,项目名称:swift,代码行数:12,代码来源:SILValueProjection.cpp

示例2: createMemLocation

MemLocation MemLocation::createMemLocation(SILValue Base, ProjectionPath &P1,
                                           ProjectionPath &P2) {
  ProjectionPath T;
  T.append(P1);
  T.append(P2);
  return MemLocation(Base, T);
}
开发者ID:asdfeng,项目名称:swift,代码行数:7,代码来源:MemLocation.cpp

示例3: while

void
ProjectionPath::expandTypeIntoLeafProjectionPaths(SILType B, SILModule *Mod,
        ProjectionPathList &Paths,
        bool OnlyLeafNode) {
    // Perform a BFS to expand the given type into projectionpath each of
    // which contains 1 field from the type.
    ProjectionPathList Worklist;
    llvm::SmallVector<Projection, 8> Projections;

    // Push an empty projection path to get started.
    SILType Ty;
    ProjectionPath P;
    Worklist.push_back(std::move(P));
    do {
        // Get the next level projections based on current projection's type.
        Optional<ProjectionPath> PP = Worklist.pop_back_val();
        // Get the current type to process, the very first projection path will be
        // empty.
        Ty = PP.getValue().empty() ? B : PP.getValue().front().getType();

        // Get the first level projection of the current type.
        Projections.clear();
        Projection::getFirstLevelAddrProjections(Ty, *Mod, Projections);

        // Reached the end of the projection tree, this field can not be expanded
        // anymore.
        if (Projections.empty()) {
            Paths.push_back(std::move(PP.getValue()));
            continue;
        }

        // If this is a class type, we also have reached the end of the type
        // tree for this type.
        //
        // We do not push its next level projection into the worklist,
        // if we do that, we could run into an infinite loop, e.g.
        //
        //   class SelfLoop {
        //     var p : SelfLoop
        //   }
        //
        //   struct XYZ {
        //     var x : Int
        //     var y : SelfLoop
        //   }
        //
        // The worklist would never be empty in this case !.
        //
        if (Ty.getClassOrBoundGenericClass()) {
            Paths.push_back(std::move(PP.getValue()));
            continue;
        }

        // This is NOT a leaf node, keep the intermediate nodes as well.
        if (!OnlyLeafNode)
            Paths.push_back(std::move(PP.getValue()));

        // Keep expanding the location.
        for (auto &P : Projections) {
            ProjectionPath X;
            X.append(P);
            X.append(PP.getValue());
            Worklist.push_back(std::move(X));
        }
        // Keep iterating if the worklist is not empty.
    } while (!Worklist.empty());
}
开发者ID:fengweijp,项目名称:swift,代码行数:67,代码来源:Projection.cpp


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