本文整理汇总了C++中SGFContext::getIdentifier方法的典型用法代码示例。如果您正苦于以下问题:C++ SGFContext::getIdentifier方法的具体用法?C++ SGFContext::getIdentifier怎么用?C++ SGFContext::getIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SGFContext
的用法示例。
在下文中一共展示了SGFContext::getIdentifier方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emitBuiltinTypeTrait
static ManagedValue emitBuiltinTypeTrait(SILGenFunction &gen,
SILLocation loc,
SubstitutionList substitutions,
ArrayRef<ManagedValue> args,
CanFunctionType formalApplyType,
SGFContext C) {
assert(substitutions.size() == 1
&& "type trait should take a single type parameter");
assert(args.size() == 1
&& "type trait should take a single argument");
unsigned result;
auto traitTy = substitutions[0].getReplacement()->getCanonicalType();
switch ((traitTy.getPointer()->*Trait)()) {
// If the type obviously has or lacks the trait, emit a constant result.
case TypeTraitResult::IsNot:
result = 0;
break;
case TypeTraitResult::Is:
result = 1;
break;
// If not, emit the builtin call normally. Specialization may be able to
// eliminate it later, or we'll lower it away at IRGen time.
case TypeTraitResult::CanBe: {
auto &C = gen.getASTContext();
auto int8Ty = BuiltinIntegerType::get(8, C)->getCanonicalType();
auto apply = gen.B.createBuiltin(loc,
C.getIdentifier(getBuiltinName(Kind)),
SILType::getPrimitiveObjectType(int8Ty),
substitutions, args[0].getValue());
return ManagedValue::forUnmanaged(apply);
}
}
// Produce the result as an integer literal constant.
auto val = gen.B.createIntegerLiteral(
loc, SILType::getBuiltinIntegerType(8, gen.getASTContext()),
(uintmax_t)result);
return ManagedValue::forUnmanaged(val);
}