本文整理汇总了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));
}
}
示例2: createMemLocation
MemLocation MemLocation::createMemLocation(SILValue Base, ProjectionPath &P1,
ProjectionPath &P2) {
ProjectionPath T;
T.append(P1);
T.append(P2);
return MemLocation(Base, T);
}
示例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());
}