本文整理汇总了C++中Sema::getOpenCLOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ Sema::getOpenCLOptions方法的具体用法?C++ Sema::getOpenCLOptions怎么用?C++ Sema::getOpenCLOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sema
的用法示例。
在下文中一共展示了Sema::getOpenCLOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetStorageClassSpec
bool DeclSpec::SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc,
const char *&PrevSpec,
unsigned &DiagID) {
// OpenCL 1.1 6.8g: "The extern, static, auto and register storage-class
// specifiers are not supported."
// It seems sensible to prohibit private_extern too
// The cl_clang_storage_class_specifiers extension enables support for
// these storage-class specifiers.
if (S.getLangOptions().OpenCL &&
!S.getOpenCLOptions().cl_clang_storage_class_specifiers) {
switch (SC) {
case SCS_extern:
case SCS_private_extern:
case SCS_auto:
case SCS_register:
case SCS_static:
DiagID = diag::err_not_opencl_storage_class_specifier;
PrevSpec = getSpecifierName(SC);
return true;
default:
break;
}
}
if (StorageClassSpec != SCS_unspecified) {
// Maybe this is an attempt to use C++0x 'auto' outside of C++0x mode.
bool isInvalid = true;
if (TypeSpecType == TST_unspecified && S.getLangOptions().CPlusPlus) {
if (SC == SCS_auto)
return SetTypeSpecType(TST_auto, Loc, PrevSpec, DiagID);
if (StorageClassSpec == SCS_auto) {
isInvalid = SetTypeSpecType(TST_auto, StorageClassSpecLoc,
PrevSpec, DiagID);
assert(!isInvalid && "auto SCS -> TST recovery failed");
}
}
// Changing storage class is allowed only if the previous one
// was the 'extern' that is part of a linkage specification and
// the new storage class is 'typedef'.
if (isInvalid &&
!(SCS_extern_in_linkage_spec &&
StorageClassSpec == SCS_extern &&
SC == SCS_typedef))
return BadSpecifier(SC, (SCS)StorageClassSpec, PrevSpec, DiagID);
}
StorageClassSpec = SC;
StorageClassSpecLoc = Loc;
assert((unsigned)SC == StorageClassSpec && "SCS constants overflow bitfield");
return false;
}