本文整理汇总了C++中LSLocation::getPath方法的典型用法代码示例。如果您正苦于以下问题:C++ LSLocation::getPath方法的具体用法?C++ LSLocation::getPath怎么用?C++ LSLocation::getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LSLocation
的用法示例。
在下文中一共展示了LSLocation::getPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
LSLocation::expand(LSLocation Base, SILModule *M, LSLocationList &Locs,
TypeExpansionAnalysis *TE) {
const ProjectionPath &BasePath = Base.getPath().getValue();
for (const auto &P : TE->getTypeExpansion(Base.getType(M), M)) {
Locs.push_back(LSLocation(Base.getBase(), BasePath, P.getValue()));
}
}
示例2: expand
void LSLocation::expand(LSLocation Base, SILModule *M, LSLocationList &Locs,
TypeExpansionAnalysis *TE) {
// To expand a memory location to its indivisible parts, we first get the
// address projection paths from the accessed type to each indivisible field,
// i.e. leaf nodes, then we append these projection paths to the Base.
//
// Construct the LSLocation by appending the projection path from the
// accessed node to the leaf nodes.
const NewProjectionPath &BasePath = Base.getPath().getValue();
for (const auto &P : TE->getTypeExpansion(Base.getType(M), M, TEKind::TELeaf)) {
Locs.push_back(LSLocation(Base.getBase(), BasePath, P.getValue()));
}
}
示例3: reduce
void LSLocation::reduce(LSLocation &Base, SILModule *M, LSLocationSet &Locs,
TypeExpansionAnalysis *TE) {
// First, construct the LSLocation by appending the projection path from the
// accessed node to the leaf nodes.
LSLocationList Nodes;
ProjectionPath &BasePath = Base.getPath().getValue();
for (const auto &P :
TE->getTypeExpansionProjectionPaths(Base.getType(), M, TEKind::TENode)) {
Nodes.push_back(LSLocation(Base.getBase(), P.getValue(), BasePath));
}
// Second, go from leaf nodes to their parents. This guarantees that at the
// point the parent is processed, its children have been processed already.
for (auto I = Nodes.rbegin(), E = Nodes.rend(); I != E; ++I) {
LSLocationList FirstLevel;
I->getFirstLevelLSLocations(FirstLevel, M);
// Reached the end of the projection tree, this is a leaf node.
if (FirstLevel.empty())
continue;
// If this is a class reference type, we have reached end of the type tree.
if (I->getType().getClassOrBoundGenericClass())
continue;
// This is NOT a leaf node, check whether all its first level children are
// alive.
bool Alive = true;
for (auto &X : FirstLevel) {
Alive &= Locs.find(X) != Locs.end();
}
// All first level locations are alive, create the new aggregated location.
if (Alive) {
for (auto &X : FirstLevel)
Locs.erase(X);
Locs.insert(*I);
}
}
}