本文整理汇总了C++中SymExpr::typeInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ SymExpr::typeInfo方法的具体用法?C++ SymExpr::typeInfo怎么用?C++ SymExpr::typeInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymExpr
的用法示例。
在下文中一共展示了SymExpr::typeInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canRHSBeConstRef
//
// Assumes 'parent' is a PRIM_MOVE or PRIM_ASSIGN
//
// Returns false if the LHS of the move/assign indicates that the rhs cannot
// be a const-ref. For example, if we have a case like this:
//
// (move A, (set-reference B))
//
// where 'A' and 'B' are references, B cannot be a const-ref if A is not a
// const-ref.
//
// In the case of a dereference, (move A, (deref B)), this function will return
// true because we're simply reading B.
//
static bool canRHSBeConstRef(CallExpr* parent, SymExpr* use) {
INT_ASSERT(isMoveOrAssign(parent));
SymExpr* LHS = toSymExpr(parent->get(1));
CallExpr* rhs = toCallExpr(parent->get(2));
INT_ASSERT(rhs);
switch (rhs->primitive->tag) {
case PRIM_GET_MEMBER_VALUE:
case PRIM_GET_SVEC_MEMBER_VALUE:
if (LHS->isRef() == false &&
isClass(LHS->typeInfo()) == false) {
return true;
}
// fallthrough
case PRIM_GET_MEMBER:
case PRIM_GET_SVEC_MEMBER:
case PRIM_GET_REAL:
case PRIM_GET_IMAG:
case PRIM_ADDR_OF:
case PRIM_SET_REFERENCE: {
// If LHS is a reference and is not a const-ref, the reference in 'rhs'
// should not be considered a const-ref either.
//
// For the get-member primitives, I intend this to be a safe approach
// until we know what const-ref means for fields. Basically, if any field
// might be modified I do not consider the base object to be const-ref.
//
// Note that the get-*-value primitives may return a reference if the
// field is a reference.
if (LHS->isRef()) {
return inferConstRef(LHS->symbol());
}
}
default:
break;
}
return isSafeRefPrimitive(use);
}